drivers/reset/core.c:837 __reset_gpios_args_match() warn: variable dereferenced before check 'a2' (see line 834)
PATCH 18/18 drivers/reset/core.c:837 __reset_gpios_args_match() warn: variable dereferenced before check 'a2' (see line 834)
tree: https://github.com/krzk/linux n/gpio-reset-controller-shared head: 432bf1b2293de8d4f827f6ee3e32da747ddc44a3 commit: 432bf1b2293de8d4f827f6ee3e32da747ddc44a3 [18/18] reset core WIP config: i386-randconfig-141-20231231 (https://download.01.org/0day-ci/archive/20231231/[email protected]/config) compiler: gcc-12 (Debian 12.2.0-14) 12.2.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 <[email protected]> | Reported-by: Dan Carpenter <[email protected]> | Closes: https://lore.kernel.org/r/[email protected]/
smatch warnings:drivers/reset/core.c:837 __reset_gpios_args_match() warn: variable dereferenced before check 'a2' (see line 834)
vim +/a2 +837 drivers/reset/core.c
432bf1b2293de8 Krzysztof Kozlowski 2023-12-30 829 static bool __reset_gpios_args_match(const struct of_phandle_args *a1,
432bf1b2293de8 Krzysztof Kozlowski 2023-12-30 830 const struct of_phandle_args *a2)
2a9529168d430a Krzysztof Kozlowski 2023-12-28 831 {
2a9529168d430a Krzysztof Kozlowski 2023-12-28 832 unsigned int i;
2a9529168d430a Krzysztof Kozlowski 2023-12-28 833
2a9529168d430a Krzysztof Kozlowski 2023-12-28 @834 pr_err("%s:%d AAA comparing %pOF == %pOF, r->of_args=%px\n",
2a9529168d430a Krzysztof Kozlowski 2023-12-28 835 __func__, __LINE__,
432bf1b2293de8 Krzysztof Kozlowski 2023-12-30 836 a1->np, a2->np, a2);
^^^^^^Dereference
432bf1b2293de8 Krzysztof Kozlowski 2023-12-30 @837 if (!a2)
^^^
Checked too late
2a9529168d430a Krzysztof Kozlowski 2023-12-28 838 return false;
2a9529168d430a Krzysztof Kozlowski 2023-12-28 839
2a9529168d430a Krzysztof Kozlowski 2023-12-28 840 pr_err("%s:%d AAA comparing %pOF == %pOF | %u == %u\n",
2a9529168d430a Krzysztof Kozlowski 2023-12-28 841 __func__, __LINE__,
432bf1b2293de8 Krzysztof Kozlowski 2023-12-30 842 a1->np, a2->np,Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki