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, 18 Mar 2014 16:22:45 +0000
From:	David Laight <David.Laight@...LAB.COM>
To:	'Balakumaran Kannan' <kumaran.4353@...il.com>,
	"davem@...emloft.net" <davem@...emloft.net>,
	"kuznet@....inr.ac.ru" <kuznet@....inr.ac.ru>,
	"jmorris@...ei.org" <jmorris@...ei.org>,
	"yoshfuji@...ux-ipv6.org" <yoshfuji@...ux-ipv6.org>,
	"kaber@...sh.net" <kaber@...sh.net>,
	"netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: RE: [PATCH] net : Remove unnecessary assignments

From: Behalf Of Balakumaran Kannan
> Remove unnecessary assignments
> 
> Signed-off-by: Balakumaran Kannan <kumaran.4353@...il.com>
> ---
> Some unnecessary assignments has been removed from devinet_ioctl function.
> The 'ret' variable is set in multiple places, but used only based on if
> conditions. So keeping the assignment inside if will be a better.
...

These all seem to be this transform:
> -	ret = -ENODEV;
>  	dev = __dev_get_by_name(net, ifr.ifr_name);
> -	if (!dev)
> +	if (!dev) {
> +		ret = -ENODEV;
>  		goto done;
> +	}

I bet that if you look at the generated code you'll find
that the compiler generates the same code for both forms
and is likely to generate the equivalent of:
	dev = __dev_get_by_name(net, ifr.ifr_name);
	ret = -ENODEV;
	if (!dev)
		goto done;

So this is just a matter of style.

	David



--
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