Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: Dmitry Safonov <0x7f454c46@gmail.com>
To: Willem de Bruijn <willemdebruijn.kernel@gmail.com>,
	netdev@vger.kernel.org
Cc: davem@davemloft.net, kuba@kernel.org, edumazet@google.com,
	pabeni@redhat.com, linux-kselftest@vger.kernel.org,
	Willem de Bruijn <willemb@google.com>
Subject: Re: [PATCH net 1/4] selftests/net: ipsec: fix constant out of range
Date: Mon, 27 Nov 2023 14:37:01 +0000	[thread overview]
Message-ID: <f2e3a80b-ea3e-4bd7-bd38-1f36bcfc8b40@gmail.com> (raw)
In-Reply-To: <20231124171645.1011043-2-willemdebruijn.kernel@gmail.com>

On 11/24/23 17:15, Willem de Bruijn wrote:
> From: Willem de Bruijn <willemb@google.com>
> 
> 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@gmail.com>
> Signed-off-by: Willem de Bruijn <willemb@google.com>

LGTM, thanks!
Reviewed-by: Dmitry Safonov <0x7f454c46@gmail.com>

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


  reply	other threads:[~2023-11-27 14:37 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-24 17:15 [PATCH net 0/4] selftests/net: fix a few small compiler warnings Willem de Bruijn
2023-11-24 17:15 ` [PATCH net 1/4] selftests/net: ipsec: fix constant out of range Willem de Bruijn
2023-11-27 14:37   ` Dmitry Safonov [this message]
2023-11-24 17:15 ` [PATCH net 2/4] selftests/net: fix a char signedness issue Willem de Bruijn
2023-11-24 17:15 ` [PATCH net 3/4] selftests/net: unix: fix unused variable compiler warning Willem de Bruijn
2023-11-24 17:15 ` [PATCH net 4/4] selftests/net: mptcp: fix uninitialized variable warnings Willem de Bruijn
2023-11-27 12:29   ` Matthieu Baerts
2023-11-27 15:46     ` Willem de Bruijn
2023-11-27 16:33       ` Matthieu Baerts
2023-11-28  2:20 ` [PATCH net 0/4] selftests/net: fix a few small compiler warnings patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f2e3a80b-ea3e-4bd7-bd38-1f36bcfc8b40@gmail.com \
    --to=0x7f454c46@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=willemb@google.com \
    --cc=willemdebruijn.kernel@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox