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>] [day] [month] [year] [list]
Date:	Wed, 4 Apr 2012 07:57:10 +0200
From:	Lothar Waßmann <LW@...O-electronics.de>
To:	Grant Likely <grant.likely@...retlab.ca>
Cc:	Rob Herring <rob.herring@...xeda.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] devicetree: pull evaluation of of_address_to_resource() out of loop in of_dev_lookup()

Hi,

Grant Likely writes:
> On Tue,  3 Apr 2012 14:48:28 +0200, Lothar Waßmann <LW@...O-electronics.de> wrote:
> > The result of_address_to_resource(np, 0, &res) is independent from the
> > for (; lookup->compatible != NULL; lookup++) {
> > }
> > loop evaluation. Evaluate it once before entering the loop.
> > 
> > Also add a space between 'for' keyword and parens.
> > 
> > Signed-off-by: Lothar Waßmann <LW@...O-electronics.de>
> > ---
> 
> What is the reason for this patch?  The error path may be slightly
> less efficient in the failure case, but it isn't incorrect.
> 
What's not correct? If of_address_to_resource() yields a non-zero
result, the function will never reach the 'return lookup' inside the
loop but only the 'return NULL' at the end of the function. Thus it is
vain to re-evaluate of_address_to_resource() in every loop.


Lothar Waßmann
-- 
___________________________________________________________

Ka-Ro electronics GmbH | Pascalstraße 22 | D - 52076 Aachen
Phone: +49 2408 1402-0 | Fax: +49 2408 1402-10
Geschäftsführer: Matthias Kaussen
Handelsregistereintrag: Amtsgericht Aachen, HRB 4996

www.karo-electronics.de | info@...o-electronics.de
___________________________________________________________
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists