lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e7ee365f-f275-4ee0-80fb-370cb3c242ea@linux.dev>
Date: Tue, 22 Apr 2025 15:15:52 -0700
From: Martin KaFai Lau <martin.lau@...ux.dev>
To: Prabhav Kumar Vaish <pvkumar5749404@...il.com>
Cc: ast@...nel.org, daniel@...earbox.net, andrii@...nel.org,
 eddyz87@...il.com, song@...nel.org, yonghong.song@...ux.dev,
 john.fastabend@...il.com, kpsingh@...nel.org, sdf@...ichev.me,
 haoluo@...gle.com, jolsa@...nel.org, mykolal@...com, shuah@...nel.org,
 bpf@...r.kernel.org, linux-kselftest@...r.kernel.org,
 linux-kernel@...r.kernel.org
Subject: Re: [PATCH] selftests/bpf: Fix null pointer check in skb_pkt_end.c

On 4/22/25 11:23 AM, Prabhav Kumar Vaish wrote:
> Ensure that 'tcp' is checked for NULL before dereferencing. This resolves
> a potential null pointer dereference warning reported by static analysis.
> 
> Signed-off-by: Prabhav Kumar Vaish <pvkumar5749404@...il.com>
> ---
>   tools/testing/selftests/bpf/progs/skb_pkt_end.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/testing/selftests/bpf/progs/skb_pkt_end.c b/tools/testing/selftests/bpf/progs/skb_pkt_end.c
> index 3bb4451524a1..db33ff2839f7 100644
> --- a/tools/testing/selftests/bpf/progs/skb_pkt_end.c
> +++ b/tools/testing/selftests/bpf/progs/skb_pkt_end.c
> @@ -45,10 +45,10 @@ int main_prog(struct __sk_buff *skb)
>   		goto out;
>   
>   	tcp = (void*)(ip + 1);
> -	if (tcp->dest != 0)
> -		goto out;
>   	if (!tcp)

This case will never be hit, so this change is not doing anything other than 
silencing the static checker. Take a look at commit 9cc873e85800 
("selftests/bpf: Add skb_pkt_end test"). The test was written to have a specific 
llvm generated code. You will need to check the generated code is still testing 
what it is supposed to test.

pw-bot: cr

>   		goto out;
> +	if (tcp->dest != 0)
> +		goto out;
>   
>   	urg_ptr = tcp->urg_ptr;
>   


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ