netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] tipc: resize nlattr array to correct size
@ 2023-06-14  8:00 Lin Ma
  2023-06-14 10:00 ` Tung Quang Nguyen
  2023-06-15 22:10 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 5+ messages in thread
From: Lin Ma @ 2023-06-14  8:00 UTC (permalink / raw)
  To: davem, netdev, tipc-discussion; +Cc: Lin Ma

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(-)

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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* RE: [PATCH v1] tipc: resize nlattr array to correct size
  2023-06-14  8:00 [PATCH v1] tipc: resize nlattr array to correct size Lin Ma
@ 2023-06-14 10:00 ` Tung Quang Nguyen
  2023-06-14 10:51   ` Lin Ma
  2023-06-15 22:10 ` patchwork-bot+netdevbpf
  1 sibling, 1 reply; 5+ messages in thread
From: Tung Quang Nguyen @ 2023-06-14 10:00 UTC (permalink / raw)
  To: Lin Ma, davem@davemloft.net, netdev@vger.kernel.org,
	tipc-discussion@lists.sourceforge.net

>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
>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH v1] tipc: resize nlattr array to correct size
  2023-06-14 10:00 ` Tung Quang Nguyen
@ 2023-06-14 10:51   ` Lin Ma
  2023-06-14 11:03     ` Tung Quang Nguyen
  0 siblings, 1 reply; 5+ messages in thread
From: Lin Ma @ 2023-06-14 10:51 UTC (permalink / raw)
  To: Tung Quang Nguyen
  Cc: davem@davemloft.net, netdev@vger.kernel.org,
	tipc-discussion@lists.sourceforge.net

> 
> 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
> >

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH v1] tipc: resize nlattr array to correct size
  2023-06-14 10:51   ` Lin Ma
@ 2023-06-14 11:03     ` Tung Quang Nguyen
  0 siblings, 0 replies; 5+ messages in thread
From: Tung Quang Nguyen @ 2023-06-14 11:03 UTC (permalink / raw)
  To: Lin Ma
  Cc: davem@davemloft.net, netdev@vger.kernel.org,
	tipc-discussion@lists.sourceforge.net

>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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v1] tipc: resize nlattr array to correct size
  2023-06-14  8:00 [PATCH v1] tipc: resize nlattr array to correct size Lin Ma
  2023-06-14 10:00 ` Tung Quang Nguyen
@ 2023-06-15 22:10 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-06-15 22:10 UTC (permalink / raw)
  To: Lin Ma; +Cc: davem, netdev, tipc-discussion

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!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-06-15 22:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-14  8:00 [PATCH v1] tipc: resize nlattr array to correct size Lin Ma
2023-06-14 10:00 ` Tung Quang Nguyen
2023-06-14 10:51   ` Lin Ma
2023-06-14 11:03     ` Tung Quang Nguyen
2023-06-15 22:10 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).