[PATCH] utils: Remove always true checks

Maks Mishin maks.mishinfz at gmail.com
Thu Aug 22 17:04:05 UTC 2024


Expression 'res <= 4294967295UL' is always true , which may be caused
by a logical error: 'res' has a type 'unsigned long' with minimum value '0'
and a maximum value '4294967295'

Found by the static analyzer Svace.

Signed-off-by: Maks Mishin <maks.mishinFZ at gmail.com>
---
 networking/libiproute/utils.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/networking/libiproute/utils.c b/networking/libiproute/utils.c
index 3cce4a06e..9e8600f34 100644
--- a/networking/libiproute/utils.c
+++ b/networking/libiproute/utils.c
@@ -42,7 +42,7 @@ unsigned FAST_FUNC get_unsigned(char *arg, const char *errmsg)
 	if (*arg) {
 		res = strtoul(arg, &ptr, 0);
 //FIXME: "" will be accepted too, is it correct?!
-		if (!*ptr && res <= UINT_MAX) {
+		if (!*ptr) {
 			return res;
 		}
 	}
@@ -57,7 +57,7 @@ uint32_t FAST_FUNC get_u32(char *arg, const char *errmsg)
 	if (*arg) {
 		res = strtoul(arg, &ptr, 0);
 //FIXME: "" will be accepted too, is it correct?!
-		if (!*ptr && res <= 0xFFFFFFFFUL) {
+		if (!*ptr) {
 			return res;
 		}
 	}
-- 
2.30.2



More information about the busybox mailing list