[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <29503ac1-69ab-a0b7-53bc-5a7522baa289@linuxfoundation.org>
Date: Fri, 25 Mar 2022 13:55:35 -0600
From: Shuah Khan <skhan@...uxfoundation.org>
To: Haowen Bai <baihaowen@...zu.com>, shuah@...nel.org, ast@...nel.org,
daniel@...earbox.net, andrii@...nel.org, kafai@...com,
songliubraving@...com, yhs@...com, john.fastabend@...il.com,
kpsingh@...nel.org
Cc: linux-kselftest@...r.kernel.org, netdev@...r.kernel.org,
bpf@...r.kernel.org, linux-kernel@...r.kernel.org,
Shuah Khan <skhan@...uxfoundation.org>
Subject: Re: [PATCH] selftests/bpf: Fix warning comparing pointer to 0
On 3/23/22 8:08 PM, Haowen Bai wrote:
> Avoid pointer type value compared with 0 to make code clear.
>
Patch looks good to me. Please include the error/warn message
in the commit log. This gives reviewers information on how
this problem is found.
> Signed-off-by: Haowen Bai <baihaowen@...zu.com>
> ---
> tools/testing/selftests/bpf/progs/map_ptr_kern.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/testing/selftests/bpf/progs/map_ptr_kern.c b/tools/testing/selftests/bpf/progs/map_ptr_kern.c
> index b64df94..db388f5 100644
> --- a/tools/testing/selftests/bpf/progs/map_ptr_kern.c
> +++ b/tools/testing/selftests/bpf/progs/map_ptr_kern.c
> @@ -367,7 +367,7 @@ static inline int check_array_of_maps(void)
>
> VERIFY(check_default(&array_of_maps->map, map));
> inner_map = bpf_map_lookup_elem(array_of_maps, &key);
> - VERIFY(inner_map != 0);
> + VERIFY(inner_map != NULL);
> VERIFY(inner_map->map.max_entries == INNER_MAX_ENTRIES);
>
> return 1;
> @@ -394,7 +394,7 @@ static inline int check_hash_of_maps(void)
>
> VERIFY(check_default(&hash_of_maps->map, map));
> inner_map = bpf_map_lookup_elem(hash_of_maps, &key);
> - VERIFY(inner_map != 0);
> + VERIFY(inner_map != NULL);
> VERIFY(inner_map->map.max_entries == INNER_MAX_ENTRIES);
>
> return 1;
>
With the change to commit log including the error/warn message and
details on how the problems is found:
Reviewed-by: Shuah Khan <skhan@...uxfoundation.org>
thanks,
-- Shuah
Powered by blists - more mailing lists