From: Andrew Morton <akpm@linux-foundation.org>
To: Andrzej Hajda <a.hajda@samsung.com>
Cc: linux-kernel@vger.kernel.org,
Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
Marek Szyprowski <m.szyprowski@samsung.com>,
Alexander Kuleshov <kuleshovmail@gmail.com>,
Tony Luck <tony.luck@intel.com>,
Wei Yang <weiyang@linux.vnet.ibm.com>,
linux-mm@kvack.org
Subject: Re: [PATCH 33/38] mm/memblock.c: remove invalid check
Date: Mon, 21 Sep 2015 14:31:01 -0700 [thread overview]
Message-ID: <20150921143101.09426cd661fe66e65a1c06b5@linux-foundation.org> (raw)
In-Reply-To: <1442842450-29769-34-git-send-email-a.hajda@samsung.com>
On Mon, 21 Sep 2015 15:34:05 +0200 Andrzej Hajda <a.hajda@samsung.com> wrote:
> Unsigned value cannot be lesser than zero.
>
> The problem has been detected using proposed semantic patch
> scripts/coccinelle/tests/unsigned_lesser_than_zero.cocci [1].
>
> [1]: http://permalink.gmane.org/gmane.linux.kernel/2038576
>
> ...
>
> --- a/mm/memblock.c
> +++ b/mm/memblock.c
> @@ -837,7 +837,7 @@ void __init_memblock __next_reserved_mem_region(u64 *idx,
> {
> struct memblock_type *type = &memblock.reserved;
>
> - if (*idx >= 0 && *idx < type->cnt) {
> + if (*idx < type->cnt) {
Linus has in the past expressed a preference for retaining checks such
as this. iirc he finds it clearer. And perhaps safer if the type
should change in the future.
--
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>
next prev parent reply other threads:[~2015-09-21 21:31 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-21 13:33 [PATCH 00/38] Fixes related to incorrect usage of unsigned types Andrzej Hajda
2015-09-21 13:34 ` [PATCH 33/38] mm/memblock.c: remove invalid check Andrzej Hajda
2015-09-21 21:31 ` Andrew Morton [this message]
2015-09-21 13:42 ` [PATCH 00/38] Fixes related to incorrect usage of unsigned types David Howells
2015-09-22 9:13 ` Andrzej Hajda
2015-09-22 9:46 ` Jacek Anaszewski
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=20150921143101.09426cd661fe66e65a1c06b5@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=a.hajda@samsung.com \
--cc=b.zolnierkie@samsung.com \
--cc=kuleshovmail@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=m.szyprowski@samsung.com \
--cc=tony.luck@intel.com \
--cc=weiyang@linux.vnet.ibm.com \
/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