From: Kees Cook <keescook@chromium.org>
To: Yury Norov <yury.norov@gmail.com>
Cc: Christophe de Dinechin <dinechin@redhat.com>,
Rasmus Villemoes <linux@rasmusvillemoes.dk>,
Alexey Dobriyan <adobriyan@gmail.com>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Andrew Morton <akpm@linux-foundation.org>,
Zhen Lei <thunder.leizhen@huawei.com>,
linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org
Subject: Re: [PATCH v2 0/2] bitmap: Fix return values to be unsigned
Date: Tue, 17 May 2022 17:56:04 -0700 [thread overview]
Message-ID: <5E266B49-F765-438D-870A-E9F6D8646F20@chromium.org> (raw)
In-Reply-To: <YoQfzJGaDF5BQ7E4@yury-laptop>
On May 17, 2022 3:21:00 PM PDT, Yury Norov <yury.norov@gmail.com> wrote:
>On Tue, May 17, 2022 at 02:22:32PM -0700, Kees Cook wrote:
>> Hi,
>>
>> As mentioned in the last patch:
>>
>> Both nodemask and bitmap routines had mixed return values that provided
>> potentially signed results that could never happen. This was leading to
>> the compiler getting confusing about the range of possible return values
>> (it was thinking things could be negative where they could not be). Fix
>> all the nodemask and bitmap routines that should be returning unsigned
>> (or bool) values. Silences GCC 12 warnings:
>>
>> mm/swapfile.c: In function ‘setup_swap_info’:
>> mm/swapfile.c:2291:47: error: array subscript -1 is below array bounds of ‘struct plist_node[]’ [-Werror=array-bounds]
>> 2291 | p->avail_lists[i].prio = 1;
>> | ~~~~~~~~~~~~~~^~~
>> In file included from mm/swapfile.c:16:
>> ./include/linux/swap.h:292:27: note: while referencing ‘avail_lists’
>> 292 | struct plist_node avail_lists[]; /*
>> | ^~~~~~~~~~~
>>
>> This splits up the patch into the bitmap and nodemask halves, and drops
>> a needless change to the random node helper.
>>
>> I note that Alexey and Rasmus touched on this area in the past, fixing
>> up node ids to be unsigned:
>>
>> ce0725f78a56 ("numa: make "nr_online_nodes" unsigned int")
>> b9726c26dc21 ("numa: make "nr_node_ids" unsigned int")
>> 33c4fa8c6763 ("linux/nodemask.h: update bitmap wrappers to take unsigned int")
>>
>> If anyone else would like to carry this, please let me know. I'm happy
>> to carry it in my tree.
>
>I think it should go thru my tree, if no objections.
Sure thing! Thanks for the review. I'll send a v3 with the variable updated and tools/ refreshed.
-Kees
--
Kees Cook
prev parent reply other threads:[~2022-05-18 0:56 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-17 21:22 [PATCH v2 0/2] bitmap: Fix return values to be unsigned Kees Cook
2022-05-17 21:22 ` [PATCH v2 1/2] " Kees Cook
2022-05-17 21:22 ` [PATCH v2 2/2] nodemask: " Kees Cook
2022-05-17 22:15 ` Yury Norov
2022-05-17 22:21 ` [PATCH v2 0/2] bitmap: " Yury Norov
2022-05-18 0:56 ` Kees Cook [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=5E266B49-F765-438D-870A-E9F6D8646F20@chromium.org \
--to=keescook@chromium.org \
--cc=adobriyan@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=dinechin@redhat.com \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@rasmusvillemoes.dk \
--cc=thunder.leizhen@huawei.com \
--cc=yury.norov@gmail.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;
as well as URLs for NNTP newsgroup(s).