Skip to content

Commit 44194cb

Browse files
f0rm2l1nkuba-moo
authored andcommitted
net: tipc: resize nlattr array to correct size
According to nla_parse_nested_deprecated(), the tb[] is supposed to the destination array with maxtype+1 elements. In current tipc_nl_media_get() and __tipc_nl_media_set(), a larger array is used which is unnecessary. This patch resize them to a proper size. Fixes: 1e55417 ("tipc: add media set to new netlink api") Fixes: 46f15c6 ("tipc: add media get/dump to new netlink api") Signed-off-by: Lin Ma <[email protected]> Reviewed-by: Florian Westphal <[email protected]> Reviewed-by: Tung Nguyen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent e84a1e1 commit 44194cb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

net/tipc/bearer.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1258,7 +1258,7 @@ int tipc_nl_media_get(struct sk_buff *skb, struct genl_info *info)
12581258
struct tipc_nl_msg msg;
12591259
struct tipc_media *media;
12601260
struct sk_buff *rep;
1261-
struct nlattr *attrs[TIPC_NLA_BEARER_MAX + 1];
1261+
struct nlattr *attrs[TIPC_NLA_MEDIA_MAX + 1];
12621262

12631263
if (!info->attrs[TIPC_NLA_MEDIA])
12641264
return -EINVAL;
@@ -1307,7 +1307,7 @@ int __tipc_nl_media_set(struct sk_buff *skb, struct genl_info *info)
13071307
int err;
13081308
char *name;
13091309
struct tipc_media *m;
1310-
struct nlattr *attrs[TIPC_NLA_BEARER_MAX + 1];
1310+
struct nlattr *attrs[TIPC_NLA_MEDIA_MAX + 1];
13111311

13121312
if (!info->attrs[TIPC_NLA_MEDIA])
13131313
return -EINVAL;

0 commit comments

Comments
 (0)