Re: [PATCH] efistub/smbios: Add fallback for SMBIOS record lookup

From: Dan Carpenter

Date: Thu Nov 06 2025 - 08:08:25 EST


Hi Francesco,

kernel test robot noticed the following build warnings:

https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Francesco-Pompo/efistub-smbios-Add-fallback-for-SMBIOS-record-lookup/20251102-081803
base: https://git.kernel.org/pub/scm/linux/kernel/git/efi/efi.git next
patch link: https://lore.kernel.org/r/20251102001411.108385-1-francescopompo2%40gmail.com
patch subject: [PATCH] efistub/smbios: Add fallback for SMBIOS record lookup
config: i386-randconfig-141-20251103 (https://download.01.org/0day-ci/archive/20251104/202511040131.8yGeRa6u-lkp@xxxxxxxxx/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
| Closes: https://lore.kernel.org/r/202511040131.8yGeRa6u-lkp@xxxxxxxxx/

smatch warnings:
drivers/firmware/efi/libstub/smbios.c:55 verify_ep_int_checksum() error: buffer overflow 'ptr' 5 <= 14

vim +/ptr +55 drivers/firmware/efi/libstub/smbios.c

d45578057224c4 Francesco Pompo 2025-11-02 48 static bool verify_ep_int_checksum(const struct smbios_entry_point *ep)
d45578057224c4 Francesco Pompo 2025-11-02 49 {
d45578057224c4 Francesco Pompo 2025-11-02 50 const u8 *ptr = (u8 *)&ep->int_anchor;
d45578057224c4 Francesco Pompo 2025-11-02 51 u8 sum = 0;
d45578057224c4 Francesco Pompo 2025-11-02 52 int i;
d45578057224c4 Francesco Pompo 2025-11-02 53
d45578057224c4 Francesco Pompo 2025-11-02 54 for (i = 0; i < 15; i++)
d45578057224c4 Francesco Pompo 2025-11-02 @55 sum += ptr[i];

This loop reads across a bunch of struct members. We would normally
use a struct_group() to say that all the struct members are grouped
together.

d45578057224c4 Francesco Pompo 2025-11-02 56
d45578057224c4 Francesco Pompo 2025-11-02 57 return sum == 0;
d45578057224c4 Francesco Pompo 2025-11-02 58 }

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki