Message ID | 20201026022126.117741-1-zhangqilong3@huawei.com |
---|---|
State | Rejected |
Delegated to: | David Miller |
Headers | show |
Series | [v2,-next] neigh: Adjustment calculation method of neighbour path symbols | expand |
Context | Check | Description |
---|---|---|
jkicinski/cover_letter | success | Link |
jkicinski/fixes_present | success | Link |
jkicinski/patch_count | success | Link |
jkicinski/tree_selection | success | Guessed tree name to be net-next |
jkicinski/subject_prefix | warning | Target tree name not specified in the subject |
jkicinski/source_inline | success | Was 0 now: 0 |
jkicinski/verify_signedoff | success | Link |
jkicinski/module_param | success | Was 0 now: 0 |
jkicinski/build_32bit | fail | Errors and warnings before: 7 this patch: 7 |
jkicinski/kdoc | success | Errors and warnings before: 0 this patch: 0 |
jkicinski/verify_fixes | success | Link |
jkicinski/checkpatch | fail | Link |
jkicinski/build_allmodconfig_warn | success | Errors and warnings before: 3 this patch: 3 |
jkicinski/header_inline | success | Link |
jkicinski/stable | success | Stable not CCed |
On Mon, 26 Oct 2020 10:21:26 +0800 Zhang Qilong wrote: > 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]; Let's leave this. The code is fine, the re-factoring is not worth the back an forth. > char *p_name; > > t = kmemdup(&neigh_sysctl_template, sizeof(*t), GFP_KERNEL);
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);
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(-)