Commit 25a54342 authored by Colin Ian King's avatar Colin Ian King Committed by David S. Miller

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: default avatarColin Ian King <colin.king@canonical.com>
Acked-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 810810ff
...@@ -98,6 +98,9 @@ static char *get_klog_buff(unsigned int *klen) ...@@ -98,6 +98,9 @@ static char *get_klog_buff(unsigned int *klen)
char *buff; char *buff;
len = klogctl(CMD_ACTION_SIZE_BUFFER, NULL, 0); len = klogctl(CMD_ACTION_SIZE_BUFFER, NULL, 0);
if (len < 0)
return NULL;
buff = malloc(len); buff = malloc(len);
if (!buff) if (!buff)
return NULL; return NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment