tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 925cf0457d7e62ce08878ffb789189ac08ca8677
commit: 45494d77f279d0420f06376dcf105b23e300c5a4 Merge branches 'acpi-scan', 'acpi-bus', 'acpi-tables' and 'acpi-sysfs'
config: arm64-randconfig-m031-20230219 (https://download.01.org/0day-ci/archive/20230219/[email protected]/config)
compiler: aarch64-linux-gcc (GCC) 12.1.0
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
| Reported-by: Dan Carpenter <[email protected]>
| Link: https://lore.kernel.org/r/[email protected]/
New smatch warnings:
arch/arm64/kernel/acpi.c:443 acpi_ffh_address_space_arch_setup() warn: possible memory leak of 'ffh_ctxt'
Old smatch warnings:
arch/arm64/kernel/acpi.c:448 acpi_ffh_address_space_arch_setup() warn: possible memory leak of 'ffh_ctxt'
vim +/ffh_ctxt +443 arch/arm64/kernel/acpi.c
1d280ce099db39 Sudeep Holla 2022-11-10 433 int acpi_ffh_address_space_arch_setup(void *handler_ctxt, void **region_ctxt)
1d280ce099db39 Sudeep Holla 2022-11-10 434 {
1d280ce099db39 Sudeep Holla 2022-11-10 435 enum arm_smccc_conduit conduit;
1d280ce099db39 Sudeep Holla 2022-11-10 436 struct acpi_ffh_data *ffh_ctxt;
1d280ce099db39 Sudeep Holla 2022-11-10 437
1d280ce099db39 Sudeep Holla 2022-11-10 438 ffh_ctxt = kzalloc(sizeof(*ffh_ctxt), GFP_KERNEL);
1d280ce099db39 Sudeep Holla 2022-11-10 439 if (!ffh_ctxt)
1d280ce099db39 Sudeep Holla 2022-11-10 440 return -ENOMEM;
1d280ce099db39 Sudeep Holla 2022-11-10 441
1d280ce099db39 Sudeep Holla 2022-11-10 442 if (arm_smccc_get_version() < ARM_SMCCC_VERSION_1_2)
1d280ce099db39 Sudeep Holla 2022-11-10 @443 return -EOPNOTSUPP;
Do these checks before the ffh_ctxt = kzalloc()?
1d280ce099db39 Sudeep Holla 2022-11-10 444
1d280ce099db39 Sudeep Holla 2022-11-10 445 conduit = arm_smccc_1_1_get_conduit();
1d280ce099db39 Sudeep Holla 2022-11-10 446 if (conduit == SMCCC_CONDUIT_NONE) {
1d280ce099db39 Sudeep Holla 2022-11-10 447 pr_err("%s: invalid SMCCC conduit\n", __func__);
1d280ce099db39 Sudeep Holla 2022-11-10 448 return -EOPNOTSUPP;
Same
1d280ce099db39 Sudeep Holla 2022-11-10 449 }
1d280ce099db39 Sudeep Holla 2022-11-10 450
1d280ce099db39 Sudeep Holla 2022-11-10 451 if (conduit == SMCCC_CONDUIT_SMC) {
1d280ce099db39 Sudeep Holla 2022-11-10 452 ffh_ctxt->invoke_ffh_fn = __arm_smccc_smc;
1d280ce099db39 Sudeep Holla 2022-11-10 453 ffh_ctxt->invoke_ffh64_fn = arm_smccc_1_2_smc;
1d280ce099db39 Sudeep Holla 2022-11-10 454 } else {
1d280ce099db39 Sudeep Holla 2022-11-10 455 ffh_ctxt->invoke_ffh_fn = __arm_smccc_hvc;
1d280ce099db39 Sudeep Holla 2022-11-10 456 ffh_ctxt->invoke_ffh64_fn = arm_smccc_1_2_hvc;
1d280ce099db39 Sudeep Holla 2022-11-10 457 }
1d280ce099db39 Sudeep Holla 2022-11-10 458
1d280ce099db39 Sudeep Holla 2022-11-10 459 memcpy(ffh_ctxt, handler_ctxt, sizeof(ffh_ctxt->info));
1d280ce099db39 Sudeep Holla 2022-11-10 460
1d280ce099db39 Sudeep Holla 2022-11-10 461 *region_ctxt = ffh_ctxt;
1d280ce099db39 Sudeep Holla 2022-11-10 462 return AE_OK;
1d280ce099db39 Sudeep Holla 2022-11-10 463 }
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests