* drivers/net/ethernet/microchip/vcap/vcap_api_debugfs.c:275 vcap_show_admin() warn: passing zero to 'PTR_ERR'
@ 2023-01-07 8:45 Dan Carpenter
0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2023-01-07 8:45 UTC (permalink / raw)
To: oe-kbuild, Horatiu Vultur; +Cc: lkp, oe-kbuild-all, linux-kernel, Paolo Abeni
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@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-01-07 8:45 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-07 8:45 drivers/net/ethernet/microchip/vcap/vcap_api_debugfs.c:275 vcap_show_admin() warn: passing zero to 'PTR_ERR' Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).