Skip to content

Commit 0885598

Browse files
wdebruijkuba-moo
authored andcommitted
selftests/net: ipsec: fix constant out of range
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: bc2652b ("selftest/net/xfrm: Add test for ipsec tunnel") Signed-off-by: Willem de Bruijn <willemb@google.com> Reviewed-by: Dmitry Safonov <0x7f454c46@gmail.com> Link: https://lore.kernel.org/r/20231124171645.1011043-2-willemdebruijn.kernel@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent ccf49ce commit 0885598

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

tools/testing/selftests/net/ipsec.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2263,7 +2263,7 @@ static int check_results(void)
22632263

22642264
int main(int argc, char **argv)
22652265
{
2266-
unsigned int nr_process = 1;
2266+
long nr_process = 1;
22672267
int route_sock = -1, ret = KSFT_SKIP;
22682268
int test_desc_fd[2];
22692269
uint32_t route_seq;
@@ -2284,7 +2284,7 @@ int main(int argc, char **argv)
22842284
exit_usage(argv);
22852285
}
22862286

2287-
if (nr_process > MAX_PROCESSES || !nr_process) {
2287+
if (nr_process > MAX_PROCESSES || nr_process < 1) {
22882288
printk("nr_process should be between [1; %u]",
22892289
MAX_PROCESSES);
22902290
exit_usage(argv);

0 commit comments

Comments
 (0)