On Wed, May 26, 2021 at 06:05:30PM +0100, Colin King wrote: > From: Colin Ian King <colin.king@xxxxxxxxxxxxx> > > 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@xxxxxxxxxxxxx> > --- > > V2: Make mapped an unsigned long rather than casting it to unsigned long Reviewed-by: Jason Gunthorpe <jgg@xxxxxxxxxx> Jason