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] [day] [month] [year] [list]
Date:	Tue, 2 Nov 2010 23:08:40 +0300
From:	Brian Gitonga Marete <marete@...hnix.com>
To:	Stefan Richter <stefanr@...6.in-berlin.de>
Cc:	Lukas Czerner <lczerner@...hat.com>,
	kevin granade <kevin.granade@...il.com>,
	"Ted Ts'o" <tytso@....edu>, linux-ext4@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: ext4_lazyinit_thread: 'ret' may be used uninitialized in this function

Indeed. In clause 4 of Section 6.5.13 of C99, short circuit evaluation
is guaranteed in addition to left to right evaluation.

On 11/2/10, Stefan Richter <stefanr@...6.in-berlin.de> wrote:
> Lukas Czerner wrote:
>> On Tue, 2 Nov 2010, kevin granade wrote:
>>> +                       if (time_after_eq(jiffies, elr->lr_next_sched) &&
>>> +                           ext4_run_li_request(elr) != 0) {
>>> +                               /* error, remove the lazy_init job */
>>> +                               ext4_remove_li_request(elr);
>>> +                               continue;
>>>                        }
>>>
>>>                        if (time_before(elr->lr_next_sched, next_wakeup))
>>> --
>>>
>>> Though obviously it's a pretty subjective style issue.
>>> Kevin Granade
>>
>> Hmm this relies on the fact that if the first part of the condition
>> would not be true, the second part (after and) would never be invoked,
>> however I am not really sure that we can rely on that on every
>> architecture, or can we ?
>
> It is not about architecture but a C language feature.  It is relied upon
> everywhere in the kernel.  For example,
>
> 	if (p != NULL && p->m == something) {
> 		...
>
> is very common.  The || operator has the same property:  Evaluation stops as
> soon as the end result is known.  I do not know since when this minimum
> evaluation feature is guaranteed in the language, but it has to be ages now.
>
> (This is not an endorsement of one or the other coding of the patch. :-)
> --
> Stefan Richter
> -=====-==-=- =-== ---=-
> http://arcgraph.de/sr/
> --
> 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/
>


-- 
Brian Gitonga Marete
Toshnix Systems
Tel: +254722151590
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ