summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorColin Ian King <colin.king@canonical.com>2016-05-06 00:39:33 +0200
committerDavid S. Miller <davem@davemloft.net>2016-05-09 05:32:59 +0200
commit25a54342fde903b6abc2680594cf3e4864686339 (patch)
tree89be78b0f2e402ca1932aac7155ecea580f4560b
parentqede: uninitialized variable in qede_start_xmit() (diff)
downloadlinux-25a54342fde903b6abc2680594cf3e4864686339.tar.xz
linux-25a54342fde903b6abc2680594cf3e4864686339.zip
tools: bpf_jit_disasm: check for klogctl failure
klogctl can fail and return -ve len, so check for this and return NULL to avoid passing a (size_t)-1 to malloc. Signed-off-by: Colin Ian King <colin.king@canonical.com> Acked-by: Daniel Borkmann <daniel@iogearbox.net> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--tools/net/bpf_jit_disasm.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/tools/net/bpf_jit_disasm.c b/tools/net/bpf_jit_disasm.c
index 5b3241340945..544b05a53b70 100644
--- a/tools/net/bpf_jit_disasm.c
+++ b/tools/net/bpf_jit_disasm.c
@@ -98,6 +98,9 @@ static char *get_klog_buff(unsigned int *klen)
char *buff;
len = klogctl(CMD_ACTION_SIZE_BUFFER, NULL, 0);
+ if (len < 0)
+ return NULL;
+
buff = malloc(len);
if (!buff)
return NULL;