From: Matthew Wilcox <willy@infradead.org>
To: linux-kernel@vger.kernel.org
Cc: Cong Wang <xiyou.wangcong@gmail.com>
Subject: Re: [PATCH 4/5] idr: Handle integer overflow correctly
Date: Sun, 3 Nov 2019 03:41:40 -0800 [thread overview]
Message-ID: <20191103114140.GD15832@bombadil.infradead.org> (raw)
In-Reply-To: <20191103114012.30027-6-willy@infradead.org>
On Sun, Nov 03, 2019 at 03:40:11AM -0800, Matthew Wilcox wrote:
> If there is an entry at INT_MAX then idr_for_each_entry() will increment
> id after handling it. This is undefined behaviour, and is caught by
> UBSAN. Adding 1U to id forces the operation to be carried out as an
> unsigned addition which (when assigned to id) will result in INT_MIN.
> Since there is never an entry stored at INT_MIN, idr_get_next() will
> return NULL, ending the loop as expected.
This was an earlier version which got left around in the git format-patch
directory. Please ignore.
next prev parent reply other threads:[~2019-11-03 11:41 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-03 11:40 [PATCH 0/5] Misc XArray, IDR & Radix Tree patches Matthew Wilcox
2019-11-03 11:40 ` [PATCH 1/5] XArray: Fix xas_next() with a single entry at 0 Matthew Wilcox
2019-11-03 11:40 ` [PATCH 2/5] idr: Fix idr_get_next_ul race with idr_remove Matthew Wilcox
2019-11-03 11:40 ` [PATCH 3/5] radix tree: Remove radix_tree_iter_find Matthew Wilcox
2019-11-03 11:40 ` [PATCH 4/5] idr: Fix integer overflow in idr_for_each_entry Matthew Wilcox
2019-11-03 11:40 ` [PATCH 4/5] idr: Handle integer overflow correctly Matthew Wilcox
2019-11-03 11:41 ` Matthew Wilcox [this message]
2019-11-03 11:40 ` [PATCH 5/5] idr: Fix idr_alloc_u32 on 32-bit systems Matthew Wilcox
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=20191103114140.GD15832@bombadil.infradead.org \
--to=willy@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=xiyou.wangcong@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
all inboxes | Powered by JetHome®