lkml.org 
[lkml]   [2019]   [Jan]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] atm: he: fix sign-extension overflow on large shift
From
From: Colin King <colin.king@canonical.com>
Date: Tue, 15 Jan 2019 18:03:38 +0000

> From: Colin Ian King <colin.king@canonical.com>
>
> Shifting the 1 by exp by an int can lead to sign-extension overlow when
> exp is 31 since 1 is an signed int and sign-extending this result to an
> unsigned long long will set the upper 32 bits. Fix this by shifting an
> unsigned long.
>
> Detected by cppcheck:
> (warning) Shifting signed 32-bit value by 31 bits is undefined behaviour
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Applied.

\
 
 \ /
  Last update: 2019-01-17 20:48    [W:0.042 / U:4.444 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site