[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Thu, 5 May 2016 23:39:33 +0100
From: Colin King <colin.king@...onical.com>
To: "David S . Miller" <davem@...emloft.net>, netdev@...r.kernel.org
Cc: linux-kernel@...r.kernel.org
Subject: [PATCH] tools: bpf_jit_disasm: check for klogctl failure
From: Colin Ian King <colin.king@...onical.com>
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@...onical.com>
---
tools/net/bpf_jit_disasm.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/tools/net/bpf_jit_disasm.c b/tools/net/bpf_jit_disasm.c
index 5b32413..544b05a 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;
--
2.8.1
Powered by blists - more mailing lists