Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1734713 > unrolled thread

[PATCH] sysctl: remove duplicate UINT_MAX check on do_proc_douintvec_conv()

Started by"Luis R. Rodriguez" <mcgrof@kernel.org>
First post2017-09-19 09:30 +0200
Last post2017-09-20 00:00 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] sysctl: remove duplicate UINT_MAX check on do_proc_douintvec_conv() "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-09-19 09:30 +0200
    Re: [PATCH] sysctl: remove duplicate UINT_MAX check on do_proc_douintvec_conv() Kees Cook <keescook@chromium.org> - 2017-09-20 00:00 +0200

#1734713 — [PATCH] sysctl: remove duplicate UINT_MAX check on do_proc_douintvec_conv()

From"Luis R. Rodriguez" <mcgrof@kernel.org>
Date2017-09-19 09:30 +0200
Subject[PATCH] sysctl: remove duplicate UINT_MAX check on do_proc_douintvec_conv()
Message-ID<url8K-1bj-13@gated-at.bofh.it>
do_proc_douintvec_conv() has two UINT_MAX checks, we can remove one.
This has no functional changes other than fixing a compiler warning:

kernel/sysctl.c:2190]: (warning) Identical condition '*lvalp>UINT_MAX', second condition is always false

Reported-by: David Binderman <dcb314@hotmail.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
---
 kernel/sysctl.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 4c08ed4a379e..0da31bbbff18 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -2181,8 +2181,6 @@ static int do_proc_douintvec_conv(unsigned long *lvalp,
 				  int write, void *data)
 {
 	if (write) {
-		if (*lvalp > UINT_MAX)
-			return -EINVAL;
 		if (*lvalp > UINT_MAX)
 			return -EINVAL;
 		*valp = *lvalp;
-- 
2.14.0

[toc] | [next] | [standalone]


#1735283

FromKees Cook <keescook@chromium.org>
Date2017-09-20 00:00 +0200
Message-ID<uryIF-2nT-3@gated-at.bofh.it>
In reply to#1734713
On Tue, Sep 19, 2017 at 12:29 AM, Luis R. Rodriguez <mcgrof@kernel.org> wrote:
> do_proc_douintvec_conv() has two UINT_MAX checks, we can remove one.
> This has no functional changes other than fixing a compiler warning:
>
> kernel/sysctl.c:2190]: (warning) Identical condition '*lvalp>UINT_MAX', second condition is always false
>
> Reported-by: David Binderman <dcb314@hotmail.com>
> Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>

Fixes: 4f2fec00afa60 ("sysctl: simplify unsigned int support")
Acked-by: Kees Cook <keescook@chromium.org>

-Kees

> ---
>  kernel/sysctl.c | 2 --
>  1 file changed, 2 deletions(-)
>
> diff --git a/kernel/sysctl.c b/kernel/sysctl.c
> index 4c08ed4a379e..0da31bbbff18 100644
> --- a/kernel/sysctl.c
> +++ b/kernel/sysctl.c
> @@ -2181,8 +2181,6 @@ static int do_proc_douintvec_conv(unsigned long *lvalp,
>                                   int write, void *data)
>  {
>         if (write) {
> -               if (*lvalp > UINT_MAX)
> -                       return -EINVAL;
>                 if (*lvalp > UINT_MAX)
>                         return -EINVAL;
>                 *valp = *lvalp;
> --
> 2.14.0
>



-- 
Kees Cook
Pixel Security

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web