On 64bit long is 64bits - so the test is valid.

> -----Original Message-----
> From: busybox <[email protected]> On Behalf Of Maks Mishin
> Sent: 22 August 2024 18:04
> To: [email protected]
> Subject: [PATCH] utils: Remove always true checks
> 
> 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 <[email protected]>
> ---
>  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
> 
> _______________________________________________
> busybox mailing list
> [email protected]
> http://lists.busybox.net/mailman/listinfo/busybox

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, 
UK
Registration No: 1397386 (Wales)

_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to