From: Linus Torvalds <torvalds@linux-foundation.org>
To: Helge Deller <deller@gmx.de>
Cc: linux-kernel@vger.kernel.org, akpm@linux-foundation.org,
Kyle Mc Martin <kyle@hera.kernel.org>,
linux-parisc@vger.kernel.org, linux-mm <linux-mm@kvack.org>
Subject: Re: [PATCH, 2.6.28-rc5] unitialized return value in mm/mlock.c: __mlock_vma_pages_range()
Date: Sun, 16 Nov 2008 15:55:10 -0800 (PST) [thread overview]
Message-ID: <alpine.LFD.2.00.0811161551540.3468@nehalem.linux-foundation.org> (raw)
In-Reply-To: <200811170030.58246.deller@gmx.de>
On Mon, 17 Nov 2008, Helge Deller wrote:
>
> Fix an unitialized return value when compiling on parisc (with CONFIG_UNEVICTABLE_LRU=y):
> mm/mlock.c: In function `__mlock_vma_pages_range':
> mm/mlock.c:165: warning: `ret' might be used uninitialized in this function
Looks valid.
Of course, nobody should ever call this with a range that could possibly
be empty, so an equally valid approach would be to change the "while" loop
to a "do while()", and that would generate better code. But I guess the
simple unnecessary initialization is more defensive programming, in that
if some other buggy caller does set things up with an empty range, it gets
the right result.
Btw, exactly _because_ gcc warnings about uninitialized functions are
sometimes bogus (ie due to gcc simply not being able to follow things like
conditional initializations where the values are only used if they were
initialized), I would ask that people comment on these kinds of issues
when they send in patches.
Linus
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
prev parent reply other threads:[~2008-11-16 23:55 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-16 23:30 Helge Deller
2008-11-16 23:55 ` Linus Torvalds [this message]
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=alpine.LFD.2.00.0811161551540.3468@nehalem.linux-foundation.org \
--to=torvalds@linux-foundation.org \
--cc=akpm@linux-foundation.org \
--cc=deller@gmx.de \
--cc=kyle@hera.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-parisc@vger.kernel.org \
/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