Skip to content

Commit 8e1ed28

Browse files
kuba-moodavem330
authored andcommitted
genetlink: use parsed attrs in dumppolicy
Attributes are already parsed based on the policy specified in the family and ready-to-use in info->attrs. No need to call genlmsg_parse() again. Signed-off-by: Jakub Kicinski <[email protected]> Reviewed-by: Johannes Berg <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 7c1e092 commit 8e1ed28

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

net/netlink/genetlink.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1117,18 +1117,13 @@ struct ctrl_dump_policy_ctx {
11171117

11181118
static int ctrl_dumppolicy_start(struct netlink_callback *cb)
11191119
{
1120+
const struct genl_dumpit_info *info = genl_dumpit_info(cb);
11201121
struct ctrl_dump_policy_ctx *ctx = (void *)cb->ctx;
1121-
struct nlattr *tb[CTRL_ATTR_MAX + 1];
1122+
struct nlattr **tb = info->attrs;
11221123
const struct genl_family *rt;
1123-
int err;
11241124

11251125
BUILD_BUG_ON(sizeof(*ctx) > sizeof(cb->ctx));
11261126

1127-
err = genlmsg_parse(cb->nlh, &genl_ctrl, tb, genl_ctrl.maxattr,
1128-
genl_ctrl.policy, cb->extack);
1129-
if (err)
1130-
return err;
1131-
11321127
if (!tb[CTRL_ATTR_FAMILY_ID] && !tb[CTRL_ATTR_FAMILY_NAME])
11331128
return -EINVAL;
11341129

0 commit comments

Comments
 (0)