netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 -next] neigh: Adjustment calculation method of neighbour path symbols
@ 2020-10-26  2:21 Zhang Qilong
  2020-10-26 20:24 ` Jakub Kicinski
  0 siblings, 1 reply; 2+ messages in thread
From: Zhang Qilong @ 2020-10-26  2:21 UTC (permalink / raw)
  To: joe, vvs, davem, kuba; +Cc: lirongqing, roopa, netdev

Using size of "net//neigh/" is not clear, the use
of stitching("net/" + /neigh") should be clearer.

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

diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index 8e39e28b0a8d..0474e73c4f9f 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -3623,7 +3623,14 @@ 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 ];
+
+	/*
+	 * The path pattern is as follows
+	 * "net/%s/neigh/%s", minusing one
+	 * is for unnecessary terminators.
+	 */
+	char neigh_path[sizeof("net/") - 1 + IFNAMSIZ +
+			sizeof("/neigh/") + IFNAMSIZ];
 	char *p_name;
 
 	t = kmemdup(&neigh_sysctl_template, sizeof(*t), GFP_KERNEL);
-- 
2.17.1


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

end of thread, other threads:[~2020-10-26 20:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-26  2:21 [PATCH v2 -next] neigh: Adjustment calculation method of neighbour path symbols Zhang Qilong
2020-10-26 20:24 ` Jakub Kicinski

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