Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

libbpf: Fix overrun in netlink attribute iteration

I accidentally found that a change in commit 1045b03e07d8 ("netlink: fix
overrun in attribute iteration") was not synchronized to the function
`nla_ok` in tools/lib/bpf/nlattr.c, I think it is necessary to modify,
this patch will do it.

Signed-off-by: Xin Liu <liuxin350@huawei.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20220930090708.62394-1-liuxin350@huawei.com

authored by

Xin Liu and committed by
Andrii Nakryiko
51e05a8c 2efcf695

+1 -1
+1 -1
tools/lib/bpf/nlattr.c
··· 32 32 33 33 static int nla_ok(const struct nlattr *nla, int remaining) 34 34 { 35 - return remaining >= sizeof(*nla) && 35 + return remaining >= (int)sizeof(*nla) && 36 36 nla->nla_len >= sizeof(*nla) && 37 37 nla->nla_len <= remaining; 38 38 }