diff options
author | Andrey Ryabinin <aryabinin@virtuozzo.com> | 2018-08-17 15:46:57 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-08-17 16:20:30 -0700 |
commit | a718e28f538441a3b6612da9ff226973376cdf0f (patch) | |
tree | b5830c2c461c94774130af6d18428e578731c82d /mm/khugepaged.c | |
parent | 31f21da18132fc971297175077fafa3bd4184dc1 (diff) | |
download | linux-stable-a718e28f538441a3b6612da9ff226973376cdf0f.tar.gz linux-stable-a718e28f538441a3b6612da9ff226973376cdf0f.tar.bz2 linux-stable-a718e28f538441a3b6612da9ff226973376cdf0f.zip |
mm/fadvise.c: fix signed overflow UBSAN complaint
Signed integer overflow is undefined according to the C standard. The
overflow in ksys_fadvise64_64() is deliberate, but since it is signed
overflow, UBSAN complains:
UBSAN: Undefined behaviour in mm/fadvise.c:76:10
signed integer overflow:
4 + 9223372036854775805 cannot be represented in type 'long long int'
Use unsigned types to do math. Unsigned overflow is defined so UBSAN
will not complain about it. This patch doesn't change generated code.
[akpm@linux-foundation.org: add comment explaining the casts]
Link: http://lkml.kernel.org/r/20180629184453.7614-1-aryabinin@virtuozzo.com
Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
Reported-by: <icytxw@gmail.com>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Alexander Potapenko <glider@google.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/khugepaged.c')
0 files changed, 0 insertions, 0 deletions