[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20210526192123.GE1096940@ziepe.ca>
Date: Wed, 26 May 2021 16:21:23 -0300
From: Jason Gunthorpe <jgg@...pe.ca>
To: Colin King <colin.king@...onical.com>
Cc: Jérôme Glisse <jglisse@...hat.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Ralph Campbell <rcampbell@...dia.com>,
Stephen Rothwell <sfr@...b.auug.org.au>,
Alistair Popple <apopple@...dia.com>, linux-mm@...ck.org,
kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH][V2][next] mm: selftests: fix potential integer overflow
on shift of a int
On Wed, May 26, 2021 at 06:05:30PM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@...onical.com>
>
> The left shift of the int mapped is evaluated using 32 bit arithmetic
> and then assigned to an unsigned long. In the case where mapped is
> 0x80000 when PAGE_SHIFT is 12 will lead to the upper bits being
> sign extended in the unsigned long. Larger values can lead to an
> int overflow. Avoid this by making mapped an unsigned long.
>
> Addresses-Coverity: ("Uninitentional integer overflow")
> Fixes: 8b2a105c3794 ("mm: selftests for exclusive device memory")
> Signed-off-by: Colin Ian King <colin.king@...onical.com>
> ---
>
> V2: Make mapped an unsigned long rather than casting it to unsigned long
Reviewed-by: Jason Gunthorpe <jgg@...dia.com>
Jason
Powered by blists - more mailing lists