oe-kbuild.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: oe-kbuild@lists.linux.dev, Florian Westphal <fw@strlen.de>
Cc: lkp@intel.com, oe-kbuild-all@lists.linux.dev,
	linux-kernel@vger.kernel.org,
	Mat Martineau <mathew.j.martineau@linux.intel.com>
Subject: net/mptcp/pm_netlink.c:1169 mptcp_pm_parse_pm_addr_attr() warn: missing error code? 'err'
Date: Fri, 2 Dec 2022 11:49:20 +0300	[thread overview]
Message-ID: <202212021422.Uh5cCKY2-lkp@intel.com> (raw)
Message-ID: <20221202084920.jG4dADq6myqN5YHbCX9wQB227URssb_TXMQcpg2EW3Q@z> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   a4412fdd49dc011bcc2c0d81ac4cab7457092650
commit: 982f17ba1a2534b878fbcb1a5273bfbc551c5397 mptcp: netlink: split mptcp_pm_parse_addr into two functions
config: i386-randconfig-m021
compiler: gcc-11 (Debian 11.3.0-8) 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 <error27@gmail.com>

smatch warnings:
net/mptcp/pm_netlink.c:1169 mptcp_pm_parse_pm_addr_attr() warn: missing error code? 'err'

vim +/err +1169 net/mptcp/pm_netlink.c

982f17ba1a2534 Florian Westphal 2022-05-03  1145  static int mptcp_pm_parse_pm_addr_attr(struct nlattr *tb[],
982f17ba1a2534 Florian Westphal 2022-05-03  1146  				       const struct nlattr *attr,
982f17ba1a2534 Florian Westphal 2022-05-03  1147  				       struct genl_info *info,
982f17ba1a2534 Florian Westphal 2022-05-03  1148  				       struct mptcp_addr_info *addr,
982f17ba1a2534 Florian Westphal 2022-05-03  1149  				       bool require_family)
01cacb00b35cb6 Paolo Abeni      2020-03-27  1150  {
01cacb00b35cb6 Paolo Abeni      2020-03-27  1151  	int err, addr_addr;
01cacb00b35cb6 Paolo Abeni      2020-03-27  1152  
01cacb00b35cb6 Paolo Abeni      2020-03-27  1153  	if (!attr) {
01cacb00b35cb6 Paolo Abeni      2020-03-27  1154  		GENL_SET_ERR_MSG(info, "missing address info");
01cacb00b35cb6 Paolo Abeni      2020-03-27  1155  		return -EINVAL;
01cacb00b35cb6 Paolo Abeni      2020-03-27  1156  	}
01cacb00b35cb6 Paolo Abeni      2020-03-27  1157  
01cacb00b35cb6 Paolo Abeni      2020-03-27  1158  	/* no validation needed - was already done via nested policy */
01cacb00b35cb6 Paolo Abeni      2020-03-27  1159  	err = nla_parse_nested_deprecated(tb, MPTCP_PM_ADDR_ATTR_MAX, attr,
01cacb00b35cb6 Paolo Abeni      2020-03-27  1160  					  mptcp_pm_addr_policy, info->extack);
01cacb00b35cb6 Paolo Abeni      2020-03-27  1161  	if (err)
01cacb00b35cb6 Paolo Abeni      2020-03-27  1162  		return err;
01cacb00b35cb6 Paolo Abeni      2020-03-27  1163  
982f17ba1a2534 Florian Westphal 2022-05-03  1164  	if (tb[MPTCP_PM_ADDR_ATTR_ID])
982f17ba1a2534 Florian Westphal 2022-05-03  1165  		addr->id = nla_get_u8(tb[MPTCP_PM_ADDR_ATTR_ID]);
982f17ba1a2534 Florian Westphal 2022-05-03  1166  
01cacb00b35cb6 Paolo Abeni      2020-03-27  1167  	if (!tb[MPTCP_PM_ADDR_ATTR_FAMILY]) {
01cacb00b35cb6 Paolo Abeni      2020-03-27  1168  		if (!require_family)
982f17ba1a2534 Florian Westphal 2022-05-03 @1169  			return err;

"err" is zero at this point.  Presumably a negative error code was
intended.

01cacb00b35cb6 Paolo Abeni      2020-03-27  1170  
01cacb00b35cb6 Paolo Abeni      2020-03-27  1171  		NL_SET_ERR_MSG_ATTR(info->extack, attr,
01cacb00b35cb6 Paolo Abeni      2020-03-27  1172  				    "missing family");
01cacb00b35cb6 Paolo Abeni      2020-03-27  1173  		return -EINVAL;
01cacb00b35cb6 Paolo Abeni      2020-03-27  1174  	}
01cacb00b35cb6 Paolo Abeni      2020-03-27  1175  
982f17ba1a2534 Florian Westphal 2022-05-03  1176  	addr->family = nla_get_u16(tb[MPTCP_PM_ADDR_ATTR_FAMILY]);
982f17ba1a2534 Florian Westphal 2022-05-03  1177  	if (addr->family != AF_INET
01cacb00b35cb6 Paolo Abeni      2020-03-27  1178  #if IS_ENABLED(CONFIG_MPTCP_IPV6)
982f17ba1a2534 Florian Westphal 2022-05-03  1179  	    && addr->family != AF_INET6
01cacb00b35cb6 Paolo Abeni      2020-03-27  1180  #endif
01cacb00b35cb6 Paolo Abeni      2020-03-27  1181  	    ) {
01cacb00b35cb6 Paolo Abeni      2020-03-27  1182  		NL_SET_ERR_MSG_ATTR(info->extack, attr,
01cacb00b35cb6 Paolo Abeni      2020-03-27  1183  				    "unknown address family");
01cacb00b35cb6 Paolo Abeni      2020-03-27  1184  		return -EINVAL;
01cacb00b35cb6 Paolo Abeni      2020-03-27  1185  	}
982f17ba1a2534 Florian Westphal 2022-05-03  1186  	addr_addr = mptcp_pm_family_to_addr(addr->family);
01cacb00b35cb6 Paolo Abeni      2020-03-27  1187  	if (!tb[addr_addr]) {
01cacb00b35cb6 Paolo Abeni      2020-03-27  1188  		NL_SET_ERR_MSG_ATTR(info->extack, attr,
01cacb00b35cb6 Paolo Abeni      2020-03-27  1189  				    "missing address data");
01cacb00b35cb6 Paolo Abeni      2020-03-27  1190  		return -EINVAL;
01cacb00b35cb6 Paolo Abeni      2020-03-27  1191  	}

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


             reply	other threads:[~2022-12-02  8:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-02  6:39 kernel test robot [this message]
2022-12-02  8:49 ` net/mptcp/pm_netlink.c:1169 mptcp_pm_parse_pm_addr_attr() warn: missing error code? 'err' Dan Carpenter
2022-12-02 23:38 ` Mat Martineau
2022-12-03  8:29   ` Dan Carpenter
2022-12-06 10:42     ` Chen, Rong A

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=202212021422.Uh5cCKY2-lkp@intel.com \
    --to=error27@gmail.com \
    --cc=fw@strlen.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=mathew.j.martineau@linux.intel.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=oe-kbuild@lists.linux.dev \
    /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;
as well as URLs for NNTP newsgroup(s).