diff mbox

net_sched actions: use nla_parse_nested()

Message ID 1477485873-32598-1-git-send-email-johannes@sipsolutions.net
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Johannes Berg Oct. 26, 2016, 12:44 p.m. UTC
From: Johannes Berg <johannes.berg@intel.com>

Use nla_parse_nested instead of open-coding the call to
nla_parse() with the attribute data/len.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
 net/sched/act_api.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Cong Wang Oct. 27, 2016, 4:35 p.m. UTC | #1
On Wed, Oct 26, 2016 at 5:44 AM, Johannes Berg
<johannes@sipsolutions.net> wrote:
> From: Johannes Berg <johannes.berg@intel.com>
>
> Use nla_parse_nested instead of open-coding the call to
> nla_parse() with the attribute data/len.
>
> Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Acked-by: Cong Wang <xiyou.wangcong@gmail.com>
David Miller Oct. 29, 2016, 7:01 p.m. UTC | #2
From: Johannes Berg <johannes@sipsolutions.net>
Date: Wed, 26 Oct 2016 14:44:33 +0200

> From: Johannes Berg <johannes.berg@intel.com>
> 
> Use nla_parse_nested instead of open-coding the call to
> nla_parse() with the attribute data/len.
> 
> Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Applied, thanks.
diff mbox

Patch

diff --git a/net/sched/act_api.c b/net/sched/act_api.c
index c9102172ce3b..ef89ec1d51fb 100644
--- a/net/sched/act_api.c
+++ b/net/sched/act_api.c
@@ -1025,8 +1025,7 @@  static struct nlattr *find_dump_kind(const struct nlmsghdr *n)
 
 	if (tb[1] == NULL)
 		return NULL;
-	if (nla_parse(tb2, TCA_ACT_MAX, nla_data(tb[1]),
-		      nla_len(tb[1]), NULL) < 0)
+	if (nla_parse_nested(tb2, TCA_ACT_MAX, tb[1], NULL) < 0)
 		return NULL;
 	kind = tb2[TCA_ACT_KIND];