[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <94b34c96-da3b-44ee-9d7e-8daadba52aa6@web.de>
Date: Wed, 24 Apr 2024 12:40:42 +0200
From: Markus Elfring <Markus.Elfring@....de>
To: Kunwu Chan <chentao@...inos.cn>, bpf@...r.kernel.org,
linux-kselftest@...r.kernel.org, kernel-janitors@...r.kernel.org,
Alexei Starovoitov <ast@...nel.org>, Andrii Nakryiko <andrii@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>, Eduard Zingerman
<eddyz87@...il.com>, Hao Luo <haoluo@...gle.com>,
Jiri Olsa <jolsa@...nel.org>, John Fastabend <john.fastabend@...il.com>,
KP Singh <kpsingh@...nel.org>, Martin KaFai Lau <martin.lau@...ux.dev>,
Mykola Lysenko <mykolal@...com>, Shuah Khan <shuah@...nel.org>,
Song Liu <song@...nel.org>, Stanislav Fomichev <sdf@...gle.com>,
Yonghong Song <yonghong.song@...ux.dev>
Cc: LKML <linux-kernel@...r.kernel.org>, Kunwu Chan <kunwu.chan@...mail.com>
Subject: Re: [PATCH bpf-next 3/4] selftests/bpf: Add a null pointer check for
the load_btf_spec
…
> Add the malloc failure checking to avoid possible null
> dereference.
…
How do you think about the following wording variant?
Add a return value check so that a null pointer dereference will be avoided
after a memory allocation failure.
Would you like to add the tag “Fixes” accordingly?
…
> +++ b/tools/testing/selftests/bpf/test_verifier.c
> @@ -762,6 +762,8 @@ static int load_btf_spec(__u32 *types, int types_len,
> );
>
> raw_btf = malloc(sizeof(hdr) + types_len + strings_len);
> + if (!raw_btf)
> + return -ENOMEM;
…
How do you think about to reuse the variable “errno” in such an error case?
Regards,
Markus
Powered by blists - more mailing lists