1
0
Fork 0
remarkable-linux/tools/net
John Fastabend 40d526e672 bpf: fix uninitialized variable in bpf tools
[ Upstream commit 815425567d ]

Here the variable cont is used as the saved_pointer for a call to
strtok_r(). It is safe to use the value uninitialized in this
context however and the later reference is only ever used if
the strtok_r is successful. But, 'gcc-5' at least doesn't have all
this knowledge so initialize cont to NULL. Additionally, do the
natural NULL check before accessing just for completness.

The warning is the following:

./bpf/tools/bpf/bpf_dbg.c: In function ‘cmd_load’:
./bpf/tools/bpf/bpf_dbg.c:1077:13: warning: ‘cont’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  } else if (matches(subcmd, "pcap") == 0) {

Fixes: fd981e3c32 "filter: bpf_dbg: add minimal bpf debugger"
Signed-off-by: John Fastabend <john.fastabend@gmail.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-21 04:02:49 +09:00
..
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
bpf_asm.c filter: bpf_asm: add minimal bpf asm tool 2013-12-11 20:28:35 -05:00
bpf_dbg.c bpf: fix uninitialized variable in bpf tools 2018-06-21 04:02:49 +09:00
bpf_exp.l tools, bpf_asm: simplify parser rule for BPF extensions 2016-02-22 13:29:42 -05:00
bpf_exp.y tools, bpf_asm: simplify parser rule for BPF extensions 2016-02-22 13:29:42 -05:00
bpf_jit_disasm.c tools: bpf_jit_disasm: Handle large images. 2017-06-14 15:03:22 -04:00