Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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;