From: Zhang Qilong <zhangqilong3@huawei.com>
To: <joe@perches.com>, <vvs@virtuozzo.com>, <davem@davemloft.net>,
<kuba@kernel.org>
Cc: <lirongqing@baidu.com>, <roopa@cumulusnetworks.com>,
<netdev@vger.kernel.org>
Subject: [PATCH v2 -next] neigh: Adjustment calculation method of neighbour path symbols
Date: Mon, 26 Oct 2020 10:21:26 +0800 [thread overview]
Message-ID: <20201026022126.117741-1-zhangqilong3@huawei.com> (raw)
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
next reply other threads:[~2020-10-26 2:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-26 2:21 Zhang Qilong [this message]
2020-10-26 20:24 ` [PATCH v2 -next] neigh: Adjustment calculation method of neighbour path symbols Jakub Kicinski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201026022126.117741-1-zhangqilong3@huawei.com \
--to=zhangqilong3@huawei.com \
--cc=davem@davemloft.net \
--cc=joe@perches.com \
--cc=kuba@kernel.org \
--cc=lirongqing@baidu.com \
--cc=netdev@vger.kernel.org \
--cc=roopa@cumulusnetworks.com \
--cc=vvs@virtuozzo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).