From: Dan Carpenter <error27@gmail.com>
To: oe-kbuild@lists.linux.dev, Horatiu Vultur <horatiu.vultur@microchip.com>
Cc: lkp@intel.com, oe-kbuild-all@lists.linux.dev,
linux-kernel@vger.kernel.org, Paolo Abeni <pabeni@redhat.com>
Subject: drivers/net/ethernet/microchip/vcap/vcap_api_debugfs.c:275 vcap_show_admin() warn: passing zero to 'PTR_ERR'
Date: Sat, 7 Jan 2023 11:45:39 +0300 [thread overview]
Message-ID: <202301071222.ef1ERM6s-lkp@intel.com> (raw)
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
reply other threads:[~2023-01-07 8:45 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202301071222.ef1ERM6s-lkp@intel.com \
--to=error27@gmail.com \
--cc=horatiu.vultur@microchip.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=oe-kbuild@lists.linux.dev \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox