[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20191103114140.GD15832@bombadil.infradead.org>
Date: Sun, 3 Nov 2019 03:41:40 -0800
From: Matthew Wilcox <willy@...radead.org>
To: linux-kernel@...r.kernel.org
Cc: Cong Wang <xiyou.wangcong@...il.com>
Subject: Re: [PATCH 4/5] idr: Handle integer overflow correctly
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.
Powered by blists - more mailing lists