linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sysctl: remove duplicate UINT_MAX check on do_proc_douintvec_conv()
@ 2017-09-19  7:29 Luis R. Rodriguez
  2017-09-19 21:52 ` Kees Cook
  0 siblings, 1 reply; 2+ messages in thread
From: Luis R. Rodriguez @ 2017-09-19  7:29 UTC (permalink / raw)
  To: akpm, keescook; +Cc: dcb314, linux-fsdevel, linux-kernel, Luis R. Rodriguez

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

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

* Re: [PATCH] sysctl: remove duplicate UINT_MAX check on do_proc_douintvec_conv()
  2017-09-19  7:29 [PATCH] sysctl: remove duplicate UINT_MAX check on do_proc_douintvec_conv() Luis R. Rodriguez
@ 2017-09-19 21:52 ` Kees Cook
  0 siblings, 0 replies; 2+ messages in thread
From: Kees Cook @ 2017-09-19 21:52 UTC (permalink / raw)
  To: Luis R. Rodriguez
  Cc: Andrew Morton, David Binderman, linux-fsdevel@vger.kernel.org,
	LKML

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

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

end of thread, other threads:[~2017-09-19 21:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-19  7:29 [PATCH] sysctl: remove duplicate UINT_MAX check on do_proc_douintvec_conv() Luis R. Rodriguez
2017-09-19 21:52 ` Kees Cook

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