[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <a9f76264-4e70-dcb3-4410-9d7e48a32657@iogearbox.net>
Date: Thu, 22 Nov 2018 00:47:31 +0100
From: Daniel Borkmann <daniel@...earbox.net>
To: Jakub Kicinski <jakub.kicinski@...ronome.com>,
alexei.starovoitov@...il.com
Cc: oss-drivers@...ronome.com, netdev@...r.kernel.org,
Wen Yang <wen.yang99@....com.cn>,
Julia Lawall <julia.lawall@...6.fr>
Subject: Re: [PATCH bpf] tools: bpftool: fix potential NULL pointer
dereference in do_load
On 11/21/2018 10:53 PM, Jakub Kicinski wrote:
> This patch fixes a possible null pointer dereference in
> do_load, detected by the semantic patch deref_null.cocci,
> with the following warning:
>
> ./tools/bpf/bpftool/prog.c:1021:23-25: ERROR: map_replace is NULL but dereferenced.
>
> The following code has potential null pointer references:
> 881 map_replace = reallocarray(map_replace, old_map_fds + 1,
> 882 sizeof(*map_replace));
> 883 if (!map_replace) {
> 884 p_err("mem alloc failed");
> 885 goto err_free_reuse_maps;
> 886 }
>
> ...
> 1019 err_free_reuse_maps:
> 1020 for (i = 0; i < old_map_fds; i++)
> 1021 close(map_replace[i].fd);
> 1022 free(map_replace);
>
> Fixes: 3ff5a4dc5d89 ("tools: bpftool: allow reuse of maps with bpftool prog load")
> Co-developed-by: Wen Yang <wen.yang99@....com.cn>
> Signed-off-by: Wen Yang <wen.yang99@....com.cn>
> Signed-off-by: Jakub Kicinski <jakub.kicinski@...ronome.com>
Applied to bpf, thanks everyone!
Powered by blists - more mailing lists