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]
Date: Fri, 10 May 2024 16:24:32 +0500
From: Muhammad Usama Anjum <usama.anjum@...labora.com>
To: kunwu.chan@...ux.dev, ast@...nel.org, daniel@...earbox.net,
 andrii@...nel.org, martin.lau@...ux.dev, eddyz87@...il.com, song@...nel.org,
 yonghong.song@...ux.dev, john.fastabend@...il.com, kpsingh@...nel.org,
 sdf@...gle.com, haoluo@...gle.com, jolsa@...nel.org, mykolal@...com,
 shuah@...nel.org, kunwu.chan@...mail.com
Cc: Muhammad Usama Anjum <usama.anjum@...labora.com>, bpf@...r.kernel.org,
 linux-kselftest@...r.kernel.org, linux-kernel@...r.kernel.org,
 Kunwu Chan <chentao@...inos.cn>
Subject: Re: [PATCH bpf-next v2 4/4] selftests/bpf: Add a null pointer check
 for the serial_test_tp_attach_query

On 5/10/24 2:58 PM, kunwu.chan@...ux.dev wrote:
> From: Kunwu Chan <chentao@...inos.cn>
> 
> There is a 'malloc' call, which can be unsuccessful.
> Add the malloc failure checking to avoid possible null
> dereference.
> 
> Signed-off-by: Kunwu Chan <chentao@...inos.cn>
> Suggested-by: Daniel Borkmann <daniel@...earbox.net>
> ---
> Changes in v2:
> 	- Use ASSERT* instead of CHECK
> 	- Add suggested-by tag
> ---
>  tools/testing/selftests/bpf/prog_tests/tp_attach_query.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/tools/testing/selftests/bpf/prog_tests/tp_attach_query.c b/tools/testing/selftests/bpf/prog_tests/tp_attach_query.c
> index 655d69f0ff0b..a5ebfc172ad8 100644
> --- a/tools/testing/selftests/bpf/prog_tests/tp_attach_query.c
> +++ b/tools/testing/selftests/bpf/prog_tests/tp_attach_query.c
> @@ -39,6 +39,9 @@ void serial_test_tp_attach_query(void)
>  	attr.wakeup_events = 1;
>  
>  	query = malloc(sizeof(*query) + sizeof(__u32) * num_progs);
> +	if (!ASSERT_OK_PTR(query, "malloc"))
> +		return;
> +
LGTM
Reviewed-by: Muhammad Usama Anjum <usama.anjum@...labora.com>

>  	for (i = 0; i < num_progs; i++) {
>  		err = bpf_prog_test_load(file, BPF_PROG_TYPE_TRACEPOINT, &obj[i],
>  				    &prog_fd[i]);

-- 
BR,
Muhammad Usama Anjum

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ