public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: Stefan Richter <stefanr@s5r6.in-berlin.de>
To: Lukas Czerner <lczerner@redhat.com>
Cc: kevin granade <kevin.granade@gmail.com>,
	"Ted Ts'o" <tytso@mit.edu>,
	linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: ext4_lazyinit_thread: 'ret' may be used uninitialized in this function
Date: Tue, 02 Nov 2010 20:49:25 +0100	[thread overview]
Message-ID: <4CD06B45.2070704@s5r6.in-berlin.de> (raw)
In-Reply-To: <alpine.LFD.2.00.1011021516470.16869@dhcp-lab-213.englab.brq.redhat.com>

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/

  parent reply	other threads:[~2010-11-02 19:49 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-31 17:28 ext4_lazyinit_thread: 'ret' may be used uninitialized in this function Stefan Richter
2010-11-01 15:27 ` Lukas Czerner
2010-11-01 19:04   ` Stefan Richter
2010-11-02 18:29   ` Ted Ts'o
2010-11-02 18:46     ` kevin granade
2010-11-02 19:19       ` Lukas Czerner
2010-11-02 19:31         ` Nick Bowler
2010-11-02 19:49         ` Stefan Richter [this message]
2010-11-02 20:08           ` Brian Gitonga Marete
2010-11-02 19:16     ` Lukas Czerner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4CD06B45.2070704@s5r6.in-berlin.de \
    --to=stefanr@s5r6.in-berlin.de \
    --cc=kevin.granade@gmail.com \
    --cc=lczerner@redhat.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox