KSPP / linux

Linux kernel source tree (Kernel Self Protection Project)
https://kernsec.org/wiki/index.php/Kernel_Self_Protection_Project
Other
80 stars 5 forks source link

Address -Warray-bounds warning in drivers/firmware/efi/libstub/zboot.c #327

Open GustavoARSilva opened 1 year ago

GustavoARSilva commented 1 year ago

Found after building ARM64 with allmodconfig:

In function 'get_unaligned_le32',
    inlined from 'efi_zboot_entry' at drivers/firmware/efi/libstub/zboot.c:93:15:
include/asm-generic/unaligned.h:14:15: warning: array subscript -1 is outside array bounds of 'char[]' [-Warray-bounds=]
   14 |         __pptr->x;                                                              \
      |         ~~~~~~^~~
include/uapi/linux/byteorder/little_endian.h:35:51: note: in definition of macro '__le32_to_cpu'
   35 | #define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
      |                                                   ^
include/asm-generic/unaligned.h:32:28: note: in expansion of macro '__get_unaligned_t'
   32 |         return le32_to_cpu(__get_unaligned_t(__le32, p));
      |                            ^~~~~~~~~~~~~~~~~
drivers/firmware/efi/libstub/zboot.c: In function 'efi_zboot_entry':
drivers/firmware/efi/libstub/zboot.c:33:30: note: at offset -4 into object '_gzdata_end' of size [0, 9223372036854775807]
   33 | extern char _gzdata_start[], _gzdata_end[];
      |                              ^~~~~~~~~~~