* [PATCH 1/1] net: vlan: Use sizeof instead of literal number
@ 2016-10-18 0:44 fgao
2016-10-18 0:59 ` Feng Gao
2016-10-18 18:23 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: fgao @ 2016-10-18 0:44 UTC (permalink / raw)
To: kaber, davem, netdev; +Cc: gfree.wind, Gao Feng
From: Gao Feng <fgao@ikuai8.com>
Use sizeof variable instead of literal number to enhance the readability.
Signed-off-by: Gao Feng <fgao@ikuai8.com>
---
net/8021q/vlan.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index 8de138d..5a3903b 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -515,8 +515,8 @@ static int vlan_ioctl_handler(struct net *net, void __user *arg)
return -EFAULT;
/* Null terminate this sucker, just in case. */
- args.device1[23] = 0;
- args.u.device2[23] = 0;
+ args.device1[sizeof(args.device1) - 1] = 0;
+ args.u.device2[sizeof(args.u.device2) - 1] = 0;
rtnl_lock();
--
1.9.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] net: vlan: Use sizeof instead of literal number
2016-10-18 0:44 [PATCH 1/1] net: vlan: Use sizeof instead of literal number fgao
@ 2016-10-18 0:59 ` Feng Gao
2016-10-18 18:23 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Feng Gao @ 2016-10-18 0:59 UTC (permalink / raw)
To: Patrick McHardy, David S. Miller, Linux Kernel Network Developers
Cc: Feng Gao, Gao Feng
On Tue, Oct 18, 2016 at 8:44 AM, <fgao@ikuai8.com> wrote:
> From: Gao Feng <fgao@ikuai8.com>
>
> Use sizeof variable instead of literal number to enhance the readability.
>
> Signed-off-by: Gao Feng <fgao@ikuai8.com>
> ---
> net/8021q/vlan.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
> index 8de138d..5a3903b 100644
> --- a/net/8021q/vlan.c
> +++ b/net/8021q/vlan.c
> @@ -515,8 +515,8 @@ static int vlan_ioctl_handler(struct net *net, void __user *arg)
> return -EFAULT;
>
> /* Null terminate this sucker, just in case. */
> - args.device1[23] = 0;
> - args.u.device2[23] = 0;
> + args.device1[sizeof(args.device1) - 1] = 0;
> + args.u.device2[sizeof(args.u.device2) - 1] = 0;
>
> rtnl_lock();
>
> --
> 1.9.1
>
>
Sorry, I forget add the "net-next" in the title.
Now I have sent another new patch, please ignore this conversation.
Regards
Feng
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] net: vlan: Use sizeof instead of literal number
2016-10-18 0:44 [PATCH 1/1] net: vlan: Use sizeof instead of literal number fgao
2016-10-18 0:59 ` Feng Gao
@ 2016-10-18 18:23 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2016-10-18 18:23 UTC (permalink / raw)
To: fgao; +Cc: kaber, netdev, gfree.wind
From: fgao@ikuai8.com
Date: Tue, 18 Oct 2016 08:44:02 +0800
> From: Gao Feng <fgao@ikuai8.com>
>
> Use sizeof variable instead of literal number to enhance the readability.
>
> Signed-off-by: Gao Feng <fgao@ikuai8.com>
Applied.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-10-18 18:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-18 0:44 [PATCH 1/1] net: vlan: Use sizeof instead of literal number fgao
2016-10-18 0:59 ` Feng Gao
2016-10-18 18:23 ` David Miller
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).