Re: [PATCH v2] scsi: mpi3mr: Emit uevent on controller diagnostic fault

From: Dan Carpenter
Date: Thu Jul 31 2025 - 11:45:27 EST


Hi Salomon,

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/Salomon-Dushimirimana/scsi-mpi3mr-Emit-uevent-on-controller-diagnostic-fault/20250718-034234
base: https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
patch link: https://lore.kernel.org/r/20250717194025.3218107-1-salomondush%40google.com
patch subject: [PATCH v2] scsi: mpi3mr: Emit uevent on controller diagnostic fault
config: x86_64-randconfig-161-20250720 (https://download.01.org/0day-ci/archive/20250721/202507211423.eXWSnhP5-lkp@xxxxxxxxx/config)
compiler: gcc-11 (Debian 11.3.0-12) 11.3.0

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/202507211423.eXWSnhP5-lkp@xxxxxxxxx/

New smatch warnings:
drivers/scsi/mpi3mr/mpi3mr_fw.c:1639 mpi3mr_fault_uevent_emit() error: uninitialized symbol 'env'.

vim +/env +1639 drivers/scsi/mpi3mr/mpi3mr_fw.c

8fe63dbd42cc3b Salomon Dushimirimana 2025-07-17 1636 static void mpi3mr_fault_uevent_emit(struct mpi3mr_ioc *mrioc, u16 reset_type,
8fe63dbd42cc3b Salomon Dushimirimana 2025-07-17 1637 u16 reset_reason)
8fe63dbd42cc3b Salomon Dushimirimana 2025-07-17 1638 {
8fe63dbd42cc3b Salomon Dushimirimana 2025-07-17 @1639 struct kobj_uevent_env *env __free(kfree);

This has to be initialized before we return

8fe63dbd42cc3b Salomon Dushimirimana 2025-07-17 1640
8fe63dbd42cc3b Salomon Dushimirimana 2025-07-17 1641 if (reset_type != MPI3_SYSIF_HOST_DIAG_RESET_ACTION_DIAG_FAULT)
8fe63dbd42cc3b Salomon Dushimirimana 2025-07-17 1642 return;

otherwise this is an uninitialized variable at this return.

8fe63dbd42cc3b Salomon Dushimirimana 2025-07-17 1643
8fe63dbd42cc3b Salomon Dushimirimana 2025-07-17 1644 env = kzalloc(sizeof(*env), GFP_KERNEL);
8fe63dbd42cc3b Salomon Dushimirimana 2025-07-17 1645 if (!env)
8fe63dbd42cc3b Salomon Dushimirimana 2025-07-17 1646 return;

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