[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202301071222.ef1ERM6s-lkp@intel.com>
Date: Sat, 7 Jan 2023 11:45:39 +0300
From: Dan Carpenter <error27@...il.com>
To: oe-kbuild@...ts.linux.dev,
Horatiu Vultur <horatiu.vultur@...rochip.com>
Cc: lkp@...el.com, oe-kbuild-all@...ts.linux.dev,
linux-kernel@...r.kernel.org, Paolo Abeni <pabeni@...hat.com>
Subject: drivers/net/ethernet/microchip/vcap/vcap_api_debugfs.c:275
vcap_show_admin() warn: passing zero to 'PTR_ERR'
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 0a71553536d270e988580a3daa9fc87535908221
commit: 610c32b2ce66d4aaa07b3a77a709bd4d2b268bb1 net: microchip: vcap: Add vcap_get_rule
config: arc-randconfig-m041-20230106
compiler: arc-elf-gcc (GCC) 12.1.0
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@...el.com>
| Reported-by: Dan Carpenter <error27@...il.com>
New smatch warnings:
drivers/net/ethernet/microchip/vcap/vcap_api_debugfs.c:275 vcap_show_admin() warn: passing zero to 'PTR_ERR'
Old smatch warnings:
drivers/net/ethernet/microchip/vcap/vcap_api_debugfs.c:103 vcap_debugfs_show_rule_keyfield() error: uninitialized symbol 'value'.
drivers/net/ethernet/microchip/vcap/vcap_api_debugfs.c:106 vcap_debugfs_show_rule_keyfield() error: uninitialized symbol 'mask'.
vim +/PTR_ERR +275 drivers/net/ethernet/microchip/vcap/vcap_api_debugfs.c
3a7921560d2fd3 Steen Hegelund 2022-11-17 263 static int vcap_show_admin(struct vcap_control *vctrl,
3a7921560d2fd3 Steen Hegelund 2022-11-17 264 struct vcap_admin *admin,
3a7921560d2fd3 Steen Hegelund 2022-11-17 265 struct vcap_output_print *out)
3a7921560d2fd3 Steen Hegelund 2022-11-17 266 {
610c32b2ce66d4 Horatiu Vultur 2022-12-03 267 struct vcap_rule_internal *elem;
610c32b2ce66d4 Horatiu Vultur 2022-12-03 268 struct vcap_rule *vrule;
3a7921560d2fd3 Steen Hegelund 2022-11-17 269 int ret = 0;
3a7921560d2fd3 Steen Hegelund 2022-11-17 270
3a7921560d2fd3 Steen Hegelund 2022-11-17 271 vcap_show_admin_info(vctrl, admin, out);
3a7921560d2fd3 Steen Hegelund 2022-11-17 272 list_for_each_entry(elem, &admin->rules, list) {
610c32b2ce66d4 Horatiu Vultur 2022-12-03 273 vrule = vcap_get_rule(vctrl, elem->data.id);
610c32b2ce66d4 Horatiu Vultur 2022-12-03 274 if (IS_ERR_OR_NULL(vrule)) {
610c32b2ce66d4 Horatiu Vultur 2022-12-03 @275 ret = PTR_ERR(vrule);
This isn't right. The error pointer and the NULL should be handled
differently. I haven't looked at vcap_get_rule() but if it really
returns both then it should be something like:
vrule = vcap_get_rule(vctrl, elem->data.id);
if (IS_ERR(vrule))
return PTR_ERR(vrule);
if (!vrule)
continue;
610c32b2ce66d4 Horatiu Vultur 2022-12-03 276 break;
682f560b8a87bf Dan Carpenter 2022-11-29 277 }
610c32b2ce66d4 Horatiu Vultur 2022-12-03 278
3a7921560d2fd3 Steen Hegelund 2022-11-17 279 out->prf(out->dst, "\n");
610c32b2ce66d4 Horatiu Vultur 2022-12-03 280 vcap_show_admin_rule(vctrl, admin, out, to_intrule(vrule));
610c32b2ce66d4 Horatiu Vultur 2022-12-03 281 vcap_free_rule(vrule);
3a7921560d2fd3 Steen Hegelund 2022-11-17 282 }
3a7921560d2fd3 Steen Hegelund 2022-11-17 283 return ret;
3a7921560d2fd3 Steen Hegelund 2022-11-17 284 }
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests
Powered by blists - more mailing lists