[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20201002215000.1526096-9-kuba@kernel.org>
Date: Fri, 2 Oct 2020 14:49:59 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: davem@...emloft.net
Cc: netdev@...r.kernel.org, andrew@...n.ch, johannes@...solutions.net,
jiri@...nulli.us, mkubecek@...e.cz, dsahern@...nel.org,
pablo@...filter.org, Jakub Kicinski <kuba@...nel.org>
Subject: [PATCH net-next v3 8/9] 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 <kuba@...nel.org>
Reviewed-by: Johannes Berg <johannes@...solutions.net>
---
net/netlink/genetlink.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c
index c3673d84d8b5..6f7cd5f577b0 100644
--- a/net/netlink/genetlink.c
+++ b/net/netlink/genetlink.c
@@ -1117,18 +1117,13 @@ struct ctrl_dump_policy_ctx {
static int ctrl_dumppolicy_start(struct netlink_callback *cb)
{
+ const struct genl_dumpit_info *info = genl_dumpit_info(cb);
struct ctrl_dump_policy_ctx *ctx = (void *)cb->ctx;
- struct nlattr *tb[CTRL_ATTR_MAX + 1];
+ struct nlattr **tb = info->attrs;
const struct genl_family *rt;
- int err;
BUILD_BUG_ON(sizeof(*ctx) > sizeof(cb->ctx));
- err = genlmsg_parse(cb->nlh, &genl_ctrl, tb, genl_ctrl.maxattr,
- genl_ctrl.policy, cb->extack);
- if (err)
- return err;
-
if (!tb[CTRL_ATTR_FAMILY_ID] && !tb[CTRL_ATTR_FAMILY_NAME])
return -EINVAL;
--
2.26.2
Powered by blists - more mailing lists