diff mbox series

[-next] neigh: remove the extra slash

Message ID 20201023100146.34948-1-zhangqilong3@huawei.com
State New
Headers show
Series [-next] neigh: remove the extra slash | expand

Commit Message

Zhang Qilong Oct. 23, 2020, 10:01 a.m. UTC
The normal path has only one slash.

Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
---
 net/core/neighbour.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Vasily Averin Oct. 23, 2020, 10:16 a.m. UTC | #1
On 10/23/20 1:01 PM, Zhang Qilong wrote:
> The normal path has only one slash.


it is not normal path
this string is used to calculate number of symbols in "net/%s/neigh/%s" used below

> Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>

> ---

>  net/core/neighbour.c | 2 +-

>  1 file changed, 1 insertion(+), 1 deletion(-)

> 

> diff --git a/net/core/neighbour.c b/net/core/neighbour.c

> index 8e39e28b0a8d..503501842a7d 100644

> --- a/net/core/neighbour.c

> +++ b/net/core/neighbour.c

> @@ -3623,7 +3623,7 @@ int neigh_sysctl_register(struct net_device *dev, struct neigh_parms *p,

>  	int i;

>  	struct neigh_sysctl_table *t;

>  	const char *dev_name_source;

> -	char neigh_path[ sizeof("net//neigh/") + IFNAMSIZ + IFNAMSIZ ];

> +	char neigh_path[sizeof("net/neigh/") + IFNAMSIZ + IFNAMSIZ];

>  	char *p_name;

>  

>  	t = kmemdup(&neigh_sysctl_template, sizeof(*t), GFP_KERNEL);

>
Joe Perches Oct. 25, 2020, 2:27 a.m. UTC | #2
On Fri, 2020-10-23 at 13:16 +0300, Vasily Averin wrote:
> On 10/23/20 1:01 PM, Zhang Qilong wrote:

> > The normal path has only one slash.

> 

> it is not normal path

> this string is used to calculate number of symbols in "net/%s/neigh/%s" used below


Then probably better would be to add +1 rather than
use a rather odd filename.

> > diff --git a/net/core/neighbour.c b/net/core/neighbour.c

[]
> > @@ -3623,7 +3623,7 @@ int neigh_sysctl_register(struct net_device *dev, struct neigh_parms *p,

> >  	int i;

> >  	struct neigh_sysctl_table *t;

> >  	const char *dev_name_source;

> > -	char neigh_path[ sizeof("net//neigh/") + IFNAMSIZ + IFNAMSIZ ];

> > +	char neigh_path[sizeof("net/neigh/") + IFNAMSIZ + IFNAMSIZ];

> >  	char *p_name;

> >  

> > 

> >  	t = kmemdup(&neigh_sysctl_template, sizeof(*t), GFP_KERNEL);

> >
diff mbox series

Patch

diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index 8e39e28b0a8d..503501842a7d 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -3623,7 +3623,7 @@  int neigh_sysctl_register(struct net_device *dev, struct neigh_parms *p,
 	int i;
 	struct neigh_sysctl_table *t;
 	const char *dev_name_source;
-	char neigh_path[ sizeof("net//neigh/") + IFNAMSIZ + IFNAMSIZ ];
+	char neigh_path[sizeof("net/neigh/") + IFNAMSIZ + IFNAMSIZ];
 	char *p_name;
 
 	t = kmemdup(&neigh_sysctl_template, sizeof(*t), GFP_KERNEL);