* [mac80211-next:genetlink-op-policy-export 14/16] net/netlink/policy.c:137 netlink_policy_dump_add_policy() warn: passing a valid pointer to 'PTR_ERR'
@ 2020-10-03 19:40 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2020-10-03 19:40 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 4628 bytes --]
CC: kbuild-all(a)lists.01.org
CC: linux-wireless(a)vger.kernel.org
TO: Johannes Berg <johannes.berg@intel.com>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git genetlink-op-policy-export
head: 4d5045adfe90c534dbf93f125c3d532ec47fe7c4
commit: 0c30f845a39a88170eba06b1841f1692a97a4088 [14/16] netlink: rework policy dump to support multiple policies
:::::: branch date: 23 hours ago
:::::: commit date: 23 hours ago
config: i386-randconfig-m021-20201004 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
smatch warnings:
net/netlink/policy.c:137 netlink_policy_dump_add_policy() warn: passing a valid pointer to 'PTR_ERR'
vim +/PTR_ERR +137 net/netlink/policy.c
0c30f845a39a88 Johannes Berg 2020-10-02 125
0c30f845a39a88 Johannes Berg 2020-10-02 126 int netlink_policy_dump_add_policy(struct netlink_policy_dump_state **pstate,
0c30f845a39a88 Johannes Berg 2020-10-02 127 const struct nla_policy *policy,
0c30f845a39a88 Johannes Berg 2020-10-02 128 unsigned int maxtype)
0c30f845a39a88 Johannes Berg 2020-10-02 129 {
0c30f845a39a88 Johannes Berg 2020-10-02 130 struct netlink_policy_dump_state *state = *pstate;
d07dcf9aadd6b2 Johannes Berg 2020-04-30 131 unsigned int policy_idx;
d07dcf9aadd6b2 Johannes Berg 2020-04-30 132 int err;
d07dcf9aadd6b2 Johannes Berg 2020-04-30 133
0c30f845a39a88 Johannes Berg 2020-10-02 134 if (!state) {
0c30f845a39a88 Johannes Berg 2020-10-02 135 state = alloc_state();
0c30f845a39a88 Johannes Berg 2020-10-02 136 if (IS_ERR(state))
0c30f845a39a88 Johannes Berg 2020-10-02 @137 return PTR_ERR(state);
0c30f845a39a88 Johannes Berg 2020-10-02 138 }
d07dcf9aadd6b2 Johannes Berg 2020-04-30 139
d07dcf9aadd6b2 Johannes Berg 2020-04-30 140 /*
d07dcf9aadd6b2 Johannes Berg 2020-04-30 141 * walk the policies and nested ones first, and build
d07dcf9aadd6b2 Johannes Berg 2020-04-30 142 * a linear list of them.
d07dcf9aadd6b2 Johannes Berg 2020-04-30 143 */
d07dcf9aadd6b2 Johannes Berg 2020-04-30 144
d07dcf9aadd6b2 Johannes Berg 2020-04-30 145 err = add_policy(&state, policy, maxtype);
d07dcf9aadd6b2 Johannes Berg 2020-04-30 146 if (err)
d07dcf9aadd6b2 Johannes Berg 2020-04-30 147 return err;
d07dcf9aadd6b2 Johannes Berg 2020-04-30 148
d07dcf9aadd6b2 Johannes Berg 2020-04-30 149 for (policy_idx = 0;
d07dcf9aadd6b2 Johannes Berg 2020-04-30 150 policy_idx < state->n_alloc && state->policies[policy_idx].policy;
d07dcf9aadd6b2 Johannes Berg 2020-04-30 151 policy_idx++) {
d07dcf9aadd6b2 Johannes Berg 2020-04-30 152 const struct nla_policy *policy;
d07dcf9aadd6b2 Johannes Berg 2020-04-30 153 unsigned int type;
d07dcf9aadd6b2 Johannes Berg 2020-04-30 154
d07dcf9aadd6b2 Johannes Berg 2020-04-30 155 policy = state->policies[policy_idx].policy;
d07dcf9aadd6b2 Johannes Berg 2020-04-30 156
d07dcf9aadd6b2 Johannes Berg 2020-04-30 157 for (type = 0;
d07dcf9aadd6b2 Johannes Berg 2020-04-30 158 type <= state->policies[policy_idx].maxtype;
d07dcf9aadd6b2 Johannes Berg 2020-04-30 159 type++) {
d07dcf9aadd6b2 Johannes Berg 2020-04-30 160 switch (policy[type].type) {
d07dcf9aadd6b2 Johannes Berg 2020-04-30 161 case NLA_NESTED:
d07dcf9aadd6b2 Johannes Berg 2020-04-30 162 case NLA_NESTED_ARRAY:
d07dcf9aadd6b2 Johannes Berg 2020-04-30 163 err = add_policy(&state,
d07dcf9aadd6b2 Johannes Berg 2020-04-30 164 policy[type].nested_policy,
d07dcf9aadd6b2 Johannes Berg 2020-04-30 165 policy[type].len);
d07dcf9aadd6b2 Johannes Berg 2020-04-30 166 if (err)
d07dcf9aadd6b2 Johannes Berg 2020-04-30 167 return err;
d07dcf9aadd6b2 Johannes Berg 2020-04-30 168 break;
d07dcf9aadd6b2 Johannes Berg 2020-04-30 169 default:
d07dcf9aadd6b2 Johannes Berg 2020-04-30 170 break;
d07dcf9aadd6b2 Johannes Berg 2020-04-30 171 }
d07dcf9aadd6b2 Johannes Berg 2020-04-30 172 }
d07dcf9aadd6b2 Johannes Berg 2020-04-30 173 }
d07dcf9aadd6b2 Johannes Berg 2020-04-30 174
0c30f845a39a88 Johannes Berg 2020-10-02 175 *pstate = state;
d07dcf9aadd6b2 Johannes Berg 2020-04-30 176 return 0;
d07dcf9aadd6b2 Johannes Berg 2020-04-30 177 }
d07dcf9aadd6b2 Johannes Berg 2020-04-30 178
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 33046 bytes --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-10-03 19:40 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-03 19:40 [mac80211-next:genetlink-op-policy-export 14/16] net/netlink/policy.c:137 netlink_policy_dump_add_policy() warn: passing a valid pointer to 'PTR_ERR' kernel test robot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.