lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 06 Aug 2013 07:37:40 -0700
From:	Joe Perches <joe@...ches.com>
To:	Daniel Borkmann <dborkman@...hat.com>
Cc:	Jean Sacren <sakiwit@...il.com>, netdev@...r.kernel.org
Subject: Re: [PATCH net-next 2/3] netdevice: remove useless else keyword

On Tue, 2013-08-06 at 10:20 +0200, Daniel Borkmann wrote:
> On 08/06/2013 09:32 AM, Jean Sacren wrote:
> > Clean up multiple useless else keywords. Add empty lines for
> > readability.
> 
> Hmm, don't really think this is actually needed or makes things better.

Maybe that's true.

Though this patch is pretty trivial and
I would (probably) not submit it, I think
it's a reasonable style rule to not use
else after an if() that always returns.

	if (foo)
		return bar;

	next_statement;

should be preferred over

	if (foo)
		return bar;
	else
		next_statement;

The blank lines though are a style taste.
Maybe removing the blank line before the
first if in this patch might be better.

{
	BUG_ON(!net);

	if (!dev_valid_name(name))
		return -EINVAL;
	if (strchr(name, '%'))
		return dev_alloc_name_ns(net, dev, name);
	if (__dev_get_by_name(net, name))
		return -EEXIST;
	if (dev->name != name)
		strlcpy(dev->name, name, IFNAMSIZ);

	return 0;
}


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ