Re: [PATCH net 1/4] selftests/net: ipsec: fix constant out of range

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11/24/23 17:15, Willem de Bruijn wrote:
> From: Willem de Bruijn <willemb@xxxxxxxxxx>
> 
> Fix a small compiler warning.
> 
> nr_process must be a signed long: it is assigned a signed long by
> strtol() and is compared against LONG_MIN and LONG_MAX.
> 
> ipsec.c:2280:65:
>     error: result of comparison of constant -9223372036854775808
>     with expression of type 'unsigned int' is always false
>     [-Werror,-Wtautological-constant-out-of-range-compare]
> 
>   if ((errno == ERANGE && (nr_process == LONG_MAX || nr_process == LONG_MIN))
> 
> Fixes: bc2652b7ae1e ("selftest/net/xfrm: Add test for ipsec tunnel")
> Cc: Dmitry Safonov <0x7f454c46@xxxxxxxxx>
> Signed-off-by: Willem de Bruijn <willemb@xxxxxxxxxx>

LGTM, thanks!
Reviewed-by: Dmitry Safonov <0x7f454c46@xxxxxxxxx>

> ---
>  tools/testing/selftests/net/ipsec.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/testing/selftests/net/ipsec.c b/tools/testing/selftests/net/ipsec.c
> index 9a8229abfa026..be4a30a0d02ae 100644
> --- a/tools/testing/selftests/net/ipsec.c
> +++ b/tools/testing/selftests/net/ipsec.c
> @@ -2263,7 +2263,7 @@ static int check_results(void)
>  
>  int main(int argc, char **argv)
>  {
> -	unsigned int nr_process = 1;
> +	long nr_process = 1;
>  	int route_sock = -1, ret = KSFT_SKIP;
>  	int test_desc_fd[2];
>  	uint32_t route_seq;
> @@ -2284,7 +2284,7 @@ int main(int argc, char **argv)
>  			exit_usage(argv);
>  		}
>  
> -		if (nr_process > MAX_PROCESSES || !nr_process) {
> +		if (nr_process > MAX_PROCESSES || nr_process < 1) {
>  			printk("nr_process should be between [1; %u]",
>  					MAX_PROCESSES);
>  			exit_usage(argv);

-- 
Dmitry





[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux