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 <>
Acked-by: default avatarDaniel Borkmann <>
Signed-off-by: default avatarDavid S. Miller <>
parent 810810ff
......@@ -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;
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