lkml.org 
[lkml]   [2022]   [May]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subject[jpirko-mlxsw:jiri_devel_components 1/3] net/core/devlink.c:6558 devlink_nl_info_fill() warn: missing error code 'err'
tree:   https://github.com/jpirko/linux_mlxsw jiri_devel_components
head: 9360f04ac2b51764d94b40113ef1b21b95835ae6
commit: e7261a9db46b29988444322b7b506954c06a7f4d [1/3] net: devlink: introduce flash components list
config: arc-randconfig-m031-20220524 (https://download.01.org/0day-ci/archive/20220528/202205281346.ewkXalBD-lkp@intel.com/config)
compiler: arceb-elf-gcc (GCC) 11.3.0

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

New smatch warnings:
net/core/devlink.c:6558 devlink_nl_info_fill() warn: missing error code 'err'

Old smatch warnings:
net/core/devlink.c:7154 devlink_fmsg_prepare_skb() error: uninitialized symbol 'err'.

vim +/err +6558 net/core/devlink.c

f9cf22882c606f Jakub Kicinski 2019-01-31 6530 static int
f9cf22882c606f Jakub Kicinski 2019-01-31 6531 devlink_nl_info_fill(struct sk_buff *msg, struct devlink *devlink,
f9cf22882c606f Jakub Kicinski 2019-01-31 6532 enum devlink_command cmd, u32 portid,
f9cf22882c606f Jakub Kicinski 2019-01-31 6533 u32 seq, int flags, struct netlink_ext_ack *extack)
f9cf22882c606f Jakub Kicinski 2019-01-31 6534 {
e7261a9db46b29 Jiri Pirko 2022-05-27 6535 struct devlink_flash_component *component;
e7261a9db46b29 Jiri Pirko 2022-05-27 6536 struct nlattr *component_attr;
f9cf22882c606f Jakub Kicinski 2019-01-31 6537 struct devlink_info_req req;
f9cf22882c606f Jakub Kicinski 2019-01-31 6538 void *hdr;
f9cf22882c606f Jakub Kicinski 2019-01-31 6539 int err;
f9cf22882c606f Jakub Kicinski 2019-01-31 6540
f9cf22882c606f Jakub Kicinski 2019-01-31 6541 hdr = genlmsg_put(msg, portid, seq, &devlink_nl_family, flags, cmd);
f9cf22882c606f Jakub Kicinski 2019-01-31 6542 if (!hdr)
f9cf22882c606f Jakub Kicinski 2019-01-31 6543 return -EMSGSIZE;
f9cf22882c606f Jakub Kicinski 2019-01-31 6544
f9cf22882c606f Jakub Kicinski 2019-01-31 6545 err = -EMSGSIZE;
f9cf22882c606f Jakub Kicinski 2019-01-31 6546 if (devlink_nl_put_handle(msg, devlink))
f9cf22882c606f Jakub Kicinski 2019-01-31 6547 goto err_cancel_msg;
f9cf22882c606f Jakub Kicinski 2019-01-31 6548
f9cf22882c606f Jakub Kicinski 2019-01-31 6549 req.msg = msg;
f9cf22882c606f Jakub Kicinski 2019-01-31 6550 err = devlink->ops->info_get(devlink, &req, extack);
f9cf22882c606f Jakub Kicinski 2019-01-31 6551 if (err)
f9cf22882c606f Jakub Kicinski 2019-01-31 6552 goto err_cancel_msg;
f9cf22882c606f Jakub Kicinski 2019-01-31 6553
e7261a9db46b29 Jiri Pirko 2022-05-27 6554 mutex_lock(&devlink->components_lock);
e7261a9db46b29 Jiri Pirko 2022-05-27 6555 list_for_each_entry(component, &devlink->component_list, list) {
e7261a9db46b29 Jiri Pirko 2022-05-27 6556 component_attr = nla_nest_start(msg, DEVLINK_ATTR_INFO_COMPONENT);
e7261a9db46b29 Jiri Pirko 2022-05-27 6557 if (!component_attr)
e7261a9db46b29 Jiri Pirko 2022-05-27 @6558 goto err_cancel_msg_unlock;

Is this an error path?

e7261a9db46b29 Jiri Pirko 2022-05-27 6559 if (nla_put_string(msg, DEVLINK_ATTR_FLASH_UPDATE_COMPONENT,
e7261a9db46b29 Jiri Pirko 2022-05-27 6560 component->name))
e7261a9db46b29 Jiri Pirko 2022-05-27 6561 goto err_cancel_msg_unlock;

Same

e7261a9db46b29 Jiri Pirko 2022-05-27 6562 err = component->info_get(devlink, &req, component->priv,
e7261a9db46b29 Jiri Pirko 2022-05-27 6563 extack);
e7261a9db46b29 Jiri Pirko 2022-05-27 6564 if (err)
e7261a9db46b29 Jiri Pirko 2022-05-27 6565 goto err_cancel_msg_unlock;
e7261a9db46b29 Jiri Pirko 2022-05-27 6566 nla_nest_end(msg, component_attr);
e7261a9db46b29 Jiri Pirko 2022-05-27 6567 }
e7261a9db46b29 Jiri Pirko 2022-05-27 6568 mutex_unlock(&devlink->components_lock);
f9cf22882c606f Jakub Kicinski 2019-01-31 6569 genlmsg_end(msg, hdr);
f9cf22882c606f Jakub Kicinski 2019-01-31 6570 return 0;
f9cf22882c606f Jakub Kicinski 2019-01-31 6571
e7261a9db46b29 Jiri Pirko 2022-05-27 6572 err_cancel_msg_unlock:
e7261a9db46b29 Jiri Pirko 2022-05-27 6573 mutex_unlock(&devlink->components_lock);
f9cf22882c606f Jakub Kicinski 2019-01-31 6574 err_cancel_msg:
f9cf22882c606f Jakub Kicinski 2019-01-31 6575 genlmsg_cancel(msg, hdr);
f9cf22882c606f Jakub Kicinski 2019-01-31 6576 return err;
f9cf22882c606f Jakub Kicinski 2019-01-31 6577 }

--
0-DAY CI Kernel Test Service
https://01.org/lkp

\
 
 \ /
  Last update: 2022-05-30 09:24    [W:0.067 / U:0.444 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site