drivers/gpu/drm/amd/amdgpu/../ras/rascore/ras_core.c:511 ras_core_get_utc_second_timestamp() error: we previously assumed 'ras_core' could be null (see line 507)
From: Dan Carpenter
Date: Wed Feb 04 2026 - 04:30:03 EST
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 6bd9ed02871f22beb0e50690b0c3caf457104f7c
commit: ace232eff50e8c898103c56b3b5303e776616274 drm/amdgpu: Add ras module files into amdgpu
config: s390-randconfig-r072-20260202 (https://download.01.org/0day-ci/archive/20260203/202602031229.RI8PLyjl-lkp@xxxxxxxxx/config)
compiler: s390-linux-gcc (GCC) 10.5.0
smatch version: v0.5.0-8994-gd50c5a4c
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/202602031229.RI8PLyjl-lkp@xxxxxxxxx/
smatch warnings:
drivers/gpu/drm/amd/amdgpu/../ras/rascore/ras_core.c:511 ras_core_get_utc_second_timestamp() error: we previously assumed 'ras_core' could be null (see line 507)
drivers/gpu/drm/amd/amdgpu/../ras/rascore/ras_core.c:530 ras_core_ras_interrupt_detected() error: we previously assumed 'ras_core' could be null (see line 526)
drivers/gpu/drm/amd/amdgpu/../ras/rascore/ras_umc.c:210 ras_umc_log_pending_bad_bank() warn: variable dereferenced before check 'ecc_node' (see line 208)
vim +/ras_core +511 drivers/gpu/drm/amd/amdgpu/../ras/rascore/ras_core.c
13c91b5b4378b5 YiPeng Chai 2025-03-17 505 uint64_t ras_core_get_utc_second_timestamp(struct ras_core_context *ras_core)
13c91b5b4378b5 YiPeng Chai 2025-03-17 506 {
13c91b5b4378b5 YiPeng Chai 2025-03-17 @507 if (ras_core && ras_core->sys_fn &&
^^^^^^^^
If ras_core is NULL
13c91b5b4378b5 YiPeng Chai 2025-03-17 508 ras_core->sys_fn->get_utc_second_timestamp)
13c91b5b4378b5 YiPeng Chai 2025-03-17 509 return ras_core->sys_fn->get_utc_second_timestamp(ras_core);
13c91b5b4378b5 YiPeng Chai 2025-03-17 510
13c91b5b4378b5 YiPeng Chai 2025-03-17 @511 RAS_DEV_ERR(ras_core->dev, "Failed to get system timestamp!\n");
^^^^^^^^^^^^^
Then this will crash.
13c91b5b4378b5 YiPeng Chai 2025-03-17 512 return 0;
13c91b5b4378b5 YiPeng Chai 2025-03-17 513 }
13c91b5b4378b5 YiPeng Chai 2025-03-17 514
13c91b5b4378b5 YiPeng Chai 2025-03-17 515 int ras_core_translate_soc_pa_and_bank(struct ras_core_context *ras_core,
13c91b5b4378b5 YiPeng Chai 2025-03-17 516 uint64_t *soc_pa, struct umc_bank_addr *bank_addr, bool bank_to_pa)
13c91b5b4378b5 YiPeng Chai 2025-03-17 517 {
13c91b5b4378b5 YiPeng Chai 2025-03-17 518 if (!ras_core || !soc_pa || !bank_addr)
13c91b5b4378b5 YiPeng Chai 2025-03-17 519 return -EINVAL;
13c91b5b4378b5 YiPeng Chai 2025-03-17 520
13c91b5b4378b5 YiPeng Chai 2025-03-17 521 return ras_umc_translate_soc_pa_and_bank(ras_core, soc_pa, bank_addr, bank_to_pa);
13c91b5b4378b5 YiPeng Chai 2025-03-17 522 }
13c91b5b4378b5 YiPeng Chai 2025-03-17 523
13c91b5b4378b5 YiPeng Chai 2025-03-17 524 bool ras_core_ras_interrupt_detected(struct ras_core_context *ras_core)
13c91b5b4378b5 YiPeng Chai 2025-03-17 525 {
13c91b5b4378b5 YiPeng Chai 2025-03-17 @526 if (ras_core && ras_core->sys_fn &&
13c91b5b4378b5 YiPeng Chai 2025-03-17 527 ras_core->sys_fn->detect_ras_interrupt)
13c91b5b4378b5 YiPeng Chai 2025-03-17 528 return ras_core->sys_fn->detect_ras_interrupt(ras_core);
13c91b5b4378b5 YiPeng Chai 2025-03-17 529
13c91b5b4378b5 YiPeng Chai 2025-03-17 @530 RAS_DEV_ERR(ras_core->dev, "Failed to detect ras interrupt!\n");
^^^^^^^^^^^^^
Same.
13c91b5b4378b5 YiPeng Chai 2025-03-17 531 return false;
13c91b5b4378b5 YiPeng Chai 2025-03-17 532 }
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki