Skip to content

Commit 25a5434

Browse files
Colin Ian Kingdavem330
authored andcommitted
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 <[email protected]> Acked-by: Daniel Borkmann <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 810810f commit 25a5434

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

tools/net/bpf_jit_disasm.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ static char *get_klog_buff(unsigned int *klen)
9898
char *buff;
9999

100100
len = klogctl(CMD_ACTION_SIZE_BUFFER, NULL, 0);
101+
if (len < 0)
102+
return NULL;
103+
101104
buff = malloc(len);
102105
if (!buff)
103106
return NULL;

0 commit comments

Comments
 (0)