WSL2-Linux-Kernel/tools/include/asm-generic
Matthias Goergens f571c8ab18 hugetlb_encode.h: fix undefined behaviour (34 << 26)
commit 710bb68c2e upstream.

Left-shifting past the size of your datatype is undefined behaviour in C.
The literal 34 gets the type `int`, and that one is not big enough to be
left shifted by 26 bits.

An `unsigned` is long enough (on any machine that has at least 32 bits for
their ints.)

For uniformity, we mark all the literals as unsigned.  But it's only
really needed for HUGETLB_FLAG_ENCODE_16GB.

Thanks to Randy Dunlap for an initial review and suggestion.

Link: https://lkml.kernel.org/r/20220905031904.150925-1-matthias.goergens@gmail.com
Signed-off-by: Matthias Goergens <matthias.goergens@gmail.com>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Mike Kravetz <mike.kravetz@oracle.com>
Cc: Muchun Song <songmuchun@bytedance.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Carlos Llamas <cmllamas@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-07-05 09:14:23 +02:00
..
bitops tools: sync lib/find_bit implementation 2021-05-06 19:24:12 -07:00
atomic-gcc.h Merge branch 'linus' into locking/core, to resolve conflicts 2017-11-07 10:32:44 +01:00
barrier.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 36 2019-05-24 17:27:11 +02:00
bitops.h xarray: Add XArray marks 2018-10-21 10:45:57 -04:00
bitsperlong.h tools: sync small_const_nbits() macro with the kernel 2021-05-06 19:24:12 -07:00
hugetlb_encode.h hugetlb_encode.h: fix undefined behaviour (34 << 26) 2024-07-05 09:14:23 +02:00
unaligned.h x86/insn: Use get_unaligned() instead of memcpy() 2021-11-18 19:16:30 +01:00