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@xxxxxxxxx>
| Reported-by: Dan Carpenter <error27@xxxxxxxxx>
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