public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org, Jiri Pirko <jiri@nvidia.com>
Cc: lkp@intel.com, kbuild-all@lists.01.org, linux-kernel@vger.kernel.org
Subject: [jpirko-mlxsw:jiri_devel_components 1/3] net/core/devlink.c:6558 devlink_nl_info_fill() warn: missing error code 'err'
Date: Mon, 30 May 2022 10:23:23 +0300	[thread overview]
Message-ID: <202205281346.ewkXalBD-lkp@intel.com> (raw)

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


                 reply	other threads:[~2022-05-30  7:23 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=202205281346.ewkXalBD-lkp@intel.com \
    --to=dan.carpenter@oracle.com \
    --cc=jiri@nvidia.com \
    --cc=kbuild-all@lists.01.org \
    --cc=kbuild@lists.01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.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