lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:   Mon, 30 May 2022 10:23:23 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     kbuild@...ts.01.org, Jiri Pirko <jiri@...dia.com>
Cc:     lkp@...el.com, kbuild-all@...ts.01.org,
        linux-kernel@...r.kernel.org
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@...el.com>
Reported-by: Dan Carpenter <dan.carpenter@...cle.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ