diff mbox series

[v1] tipc: resize nlattr array to correct size

Message ID 20230614080013.1112884-1-linma@zju.edu.cn (mailing list archive)
State Accepted
Commit 44194cb1b6045dea33ae9a0d54fb7e7cd93a2e09
Delegated to: Netdev Maintainers
Headers show
Series [v1] tipc: resize nlattr array to correct size | expand

Checks

Context Check Description
netdev/series_format warning Single patches do not need cover letters; Target tree name not specified in the subject
netdev/tree_selection success Guessed tree name to be net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 8 this patch: 8
netdev/cc_maintainers warning 5 maintainers not CCed: kuba@kernel.org jmaloy@redhat.com pabeni@redhat.com edumazet@google.com ying.xue@windriver.com
netdev/build_clang success Errors and warnings before: 8 this patch: 8
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 8 this patch: 8
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 16 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Lin Ma June 14, 2023, 8 a.m. UTC
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.

Signed-off-by: Lin Ma <linma@zju.edu.cn>
---
 net/tipc/bearer.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Tung Quang Nguyen June 14, 2023, 10 a.m. UTC | #1
>Subject: [PATCH v1] 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.
>
>Signed-off-by: Lin Ma <linma@zju.edu.cn>
>---

Which branch (net or net-next) do you want to apply this change to ?

> net/tipc/bearer.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
>diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c
>index 53881406e200..cdcd2731860b 100644
>--- a/net/tipc/bearer.c
>+++ b/net/tipc/bearer.c
>@@ -1258,7 +1258,7 @@ int tipc_nl_media_get(struct sk_buff *skb, struct genl_info *info)
> 	struct tipc_nl_msg msg;
> 	struct tipc_media *media;
> 	struct sk_buff *rep;
>-	struct nlattr *attrs[TIPC_NLA_BEARER_MAX + 1];
>+	struct nlattr *attrs[TIPC_NLA_MEDIA_MAX + 1];
>
> 	if (!info->attrs[TIPC_NLA_MEDIA])
> 		return -EINVAL;
>@@ -1307,7 +1307,7 @@ int __tipc_nl_media_set(struct sk_buff *skb, struct genl_info *info)
> 	int err;
> 	char *name;
> 	struct tipc_media *m;
>-	struct nlattr *attrs[TIPC_NLA_BEARER_MAX + 1];
>+	struct nlattr *attrs[TIPC_NLA_MEDIA_MAX + 1];
>
> 	if (!info->attrs[TIPC_NLA_MEDIA])
> 		return -EINVAL;
>--
>2.17.1
>
Lin Ma June 14, 2023, 10:51 a.m. UTC | #2
> 
> Which branch (net or net-next) do you want to apply this change to ?
> 

I don't really know the difference :D

Since this a not any new feature patch but just solving a typo like bug. I guess
it can go to (net) branch instead the (net-next) ?

Regards
Lin


> > net/tipc/bearer.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> >diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c
> >index 53881406e200..cdcd2731860b 100644
> >--- a/net/tipc/bearer.c
> >+++ b/net/tipc/bearer.c
> >@@ -1258,7 +1258,7 @@ int tipc_nl_media_get(struct sk_buff *skb, struct genl_info *info)
> > 	struct tipc_nl_msg msg;
> > 	struct tipc_media *media;
> > 	struct sk_buff *rep;
> >-	struct nlattr *attrs[TIPC_NLA_BEARER_MAX + 1];
> >+	struct nlattr *attrs[TIPC_NLA_MEDIA_MAX + 1];
> >
> > 	if (!info->attrs[TIPC_NLA_MEDIA])
> > 		return -EINVAL;
> >@@ -1307,7 +1307,7 @@ int __tipc_nl_media_set(struct sk_buff *skb, struct genl_info *info)
> > 	int err;
> > 	char *name;
> > 	struct tipc_media *m;
> >-	struct nlattr *attrs[TIPC_NLA_BEARER_MAX + 1];
> >+	struct nlattr *attrs[TIPC_NLA_MEDIA_MAX + 1];
> >
> > 	if (!info->attrs[TIPC_NLA_MEDIA])
> > 		return -EINVAL;
> >--
> >2.17.1
> >
Tung Quang Nguyen June 14, 2023, 11:03 a.m. UTC | #3
>I don't really know the difference :D
>
>Since this a not any new feature patch but just solving a typo like bug. I guess
>it can go to (net) branch instead the (net-next) ?
>
>Regards
>Lin
>
It is OK to go for net. 
Please:
- append "net" to your patch title.
- add Fixes tag to the changelog.
patchwork-bot+netdevbpf@kernel.org June 15, 2023, 10:10 p.m. UTC | #4
Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Wed, 14 Jun 2023 16:00:13 +0800 you wrote:
> 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.
> 
> Signed-off-by: Lin Ma <linma@zju.edu.cn>
> 
> [...]

Here is the summary with links:
  - [v1] tipc: resize nlattr array to correct size
    https://git.kernel.org/netdev/net/c/44194cb1b604

You are awesome, thank you!
diff mbox series

Patch

diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c
index 53881406e200..cdcd2731860b 100644
--- a/net/tipc/bearer.c
+++ b/net/tipc/bearer.c
@@ -1258,7 +1258,7 @@  int tipc_nl_media_get(struct sk_buff *skb, struct genl_info *info)
 	struct tipc_nl_msg msg;
 	struct tipc_media *media;
 	struct sk_buff *rep;
-	struct nlattr *attrs[TIPC_NLA_BEARER_MAX + 1];
+	struct nlattr *attrs[TIPC_NLA_MEDIA_MAX + 1];
 
 	if (!info->attrs[TIPC_NLA_MEDIA])
 		return -EINVAL;
@@ -1307,7 +1307,7 @@  int __tipc_nl_media_set(struct sk_buff *skb, struct genl_info *info)
 	int err;
 	char *name;
 	struct tipc_media *m;
-	struct nlattr *attrs[TIPC_NLA_BEARER_MAX + 1];
+	struct nlattr *attrs[TIPC_NLA_MEDIA_MAX + 1];
 
 	if (!info->attrs[TIPC_NLA_MEDIA])
 		return -EINVAL;