sysctl: use min() helper for namecmp()
Subsystems (3)
PATCH 1/1 sysctl: use min() helper for namecmp()
Make it slightly readable by using min().
---
fs/proc/proc_sysctl.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
fs/proc/proc_sysctl.c +1 -6
@@ -94,14 +94,9 @@ static void sysctl_print_dir(struct ctl_dir *dir)static int namecmp (const char *name1,int len1,const char *name2,int len2) { -int minlen;int cmp; - minlen = len1; -if (minlen > len2) - minlen = len2; - - cmp =memcmp (name1, name2, minlen); + cmp =memcmp (name1, name2,min (len1, len2));if (cmp ==0 ) cmp = len1 - len2;return cmp;
Signature · 1 line
2.27.0
Quoted 3 lines · Masahiro Yamada
Make it slightly readable by using
min().Signed-off-by Masahiro Yamada <[email protected]>
Signature · 1 line
Kees Cook
(CC: Andrew Morton)
A friendly reminder.
This is just a minor clean-up.
If nobody picks it up,
I hope perhaps Andrew Morton will do.
This patch:
https://lore.kernel.org/patchwork/patch/1360092/
Quoted 32 lines · Masahiro Yamada
Make it slightly readable by using
min().Signed-off-by Masahiro Yamada <[email protected]>---
fs/proc/proc_sysctl.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)fs/proc/proc_sysctl.c +1
-7@@ -94,14 +94,9 @@ static void sysctl_print_dir(struct ctl_dir *dir)static int namecmp (const char *name1,int len1,const char *name2,int len2) { -int minlen;int cmp; - minlen = len1; -if (minlen > len2) - minlen = len2; - - cmp =memcmp (name1, name2, minlen); + cmp =memcmp (name1, name2,min (len1, len2));if (cmp ==0 ) cmp = len1 - len2;return cmp; --2.27.0
Signature · 2 lines
Best Regards Masahiro Yamada
Kees Cook
Acked-byQuoted 10 lines · Masahiro Yamada
(CC: Andrew Morton)
A friendly reminder.
This is just a minor clean-up.
If nobody picks it up,
I hope perhaps Andrew Morton will do.
Quoted 12 lines
This patch:
https://lore.kernel.org/patchwork/patch/1360092/Quoted 4 lines · Masahiro Yamada
Make it slightly readable by using
min().Signed-off-by Masahiro Yamada <[email protected]>
Feel free to take this via your tree Masahiro. Thanks!
-Kees
Quoted 33 lines
Quoted 28 lines
---
fs/proc/proc_sysctl.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)fs/proc/proc_sysctl.c +1
-7@@ -94,14 +94,9 @@ static void sysctl_print_dir(struct ctl_dir *dir)static int namecmp (const char *name1,int len1,const char *name2,int len2) { -int minlen;int cmp; - minlen = len1; -if (minlen > len2) - minlen = len2; - - cmp =memcmp (name1, name2, minlen); + cmp =memcmp (name1, name2,min (len1, len2));if (cmp ==0 ) cmp = len1 - len2;return cmp; --2.27.0
Signature · 2 lines
Best Regards Masahiro Yamada
Signature · 6 lines
Kees Cook Reviewed-by: Kees Cook <[email protected]> -- Kees Cook
Quoted 65 lines · Kees Cook
Quoted 10 lines · Masahiro Yamada
(CC: Andrew Morton)
A friendly reminder.
This is just a minor clean-up.
If nobody picks it up,
I hope perhaps Andrew Morton will do.Quoted 12 lines
This patch:
https://lore.kernel.org/patchwork/patch/1360092/Quoted 4 lines · Masahiro Yamada
Make it slightly readable by using
min().Signed-off-by Masahiro Yamada <[email protected]>Acked-by Kees Cook <[email protected]>Feel free to take this via your tree Masahiro. Thanks!
-Kees
Quoted 25 lines
Quoted 25 lines
---
fs/proc/proc_sysctl.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)fs/proc/proc_sysctl.c +1
-6@@ -94,14 +94,9 @@ static void sysctl_print_dir(struct ctl_dir *dir)static int namecmp (const char *name1,int len1,const char *name2,int len2) { -int minlen;int cmp; - minlen = len1; -if (minlen > len2) - minlen = len2; - - cmp =memcmp (name1, name2, minlen); + cmp =memcmp (name1, name2,min (len1, len2));if (cmp ==0 ) cmp = len1 - len2;return cmp;Quoted 8 lines
Quoted 3 lines
--
2.27.0--
Best Regards
Masahiro Yamada
Quoted 7 lines
--
Kees CookReviewed-by Kees Cook <[email protected]>--
Kees Cook
Applied to linux-kbuild.
Signature · 2 lines
Best Regards Masahiro Yamada