Skip to contentSkip to conversation

sysctl: remove duplicate UINT_MAX check on do_proc_douintvec_conv()

PATCH Applied Luis R. Rodriguez 2 participants 2 messages Sep 19, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sysctl: remove duplicate UINT_MAX check on do_proc_douintvec_conv()

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

---
 kernel/sysctl.c | 2 --
 1 file changed, 2 deletions(-)
kernel/sysctl.c +0 -2
index 4c08ed4a379e..0da31bbbff18 100644
@@ -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;
Signature · 1 line
2.14.0
Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · 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

Fixes 4f2fec00afa60 ("sysctl: simplify unsigned int support")

-Kees

Quoted 20 lines
---
 kernel/sysctl.c | 2 --
 1 file changed, 2 deletions(-)
kernel/sysctl.c +0 -3
index 4c08ed4a379e..0da31bbbff18 100644
@@ -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

Signature · 2 lines
Kees Cook
Pixel Security