Skip to content

Commit 195e5f8

Browse files
Florian Westphalummakynes
authored andcommitted
netfilter: nf_tables: use kzalloc for hook allocation
KMSAN reports unitialized variable when registering the hook, reg->hook_ops_type == NF_HOOK_OP_BPF) ~~~~~~~~~~~ undefined This is a small structure, just use kzalloc to make sure this won't happen again when new fields get added to nf_hook_ops. Fixes: 7b4b2fa ("netfilter: annotate nf_tables base hook ops") Signed-off-by: Florian Westphal <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]>
1 parent d472e98 commit 195e5f8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/netfilter/nf_tables_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2082,7 +2082,7 @@ static struct nft_hook *nft_netdev_hook_alloc(struct net *net,
20822082
struct nft_hook *hook;
20832083
int err;
20842084

2085-
hook = kmalloc(sizeof(struct nft_hook), GFP_KERNEL_ACCOUNT);
2085+
hook = kzalloc(sizeof(struct nft_hook), GFP_KERNEL_ACCOUNT);
20862086
if (!hook) {
20872087
err = -ENOMEM;
20882088
goto err_hook_alloc;

0 commit comments

Comments
 (0)