diff options
author | Florian Westphal <fw@strlen.de> | 2024-02-21 18:38:45 +0100 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2024-02-22 00:15:58 +0100 |
commit | 195e5f88c2e48330ba5483e0bad2de3b3fad484f (patch) | |
tree | 31139babea653f443bb3f642f2602333afe5ef48 | |
parent | d472e9853d7b46a6b094224d131d09ccd3a03daf (diff) | |
download | linux-195e5f88c2e48330ba5483e0bad2de3b3fad484f.tar.gz |
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: 7b4b2fa37587 ("netfilter: annotate nf_tables base hook ops")
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Notes
Fixes: 7b4b2fa37587 ("netfilter: annotate nf_tables base hook ops") # v5.14-rc1
Stable: 73a7cdb48779 # v6.6.19
Stable: ea33b8166912 # v6.1.80
Lore: https://lore.kernel.org/r/20240221173848.5929-1-fw@strlen.de # netfilter-devel
Lore: https://lore.kernel.org/r/20240222000843.146665-6-pablo@netfilter.org # netdev, netfilter-devel
Lore: https://lore.kernel.org/r/20240227131616.183715203@linuxfoundation.org # linux-patches, stable
Lore: https://lore.kernel.org/r/20240227131634.527809975@linuxfoundation.org # linux-patches, stable
Lore: https://lore.kernel.org/r/20240227131641.073045942@linuxfoundation.org # linux-patches, stable
-rw-r--r-- | net/netfilter/nf_tables_api.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c index 485e047d5f98b..7e938c7397dda 100644 --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c @@ -2082,7 +2082,7 @@ static struct nft_hook *nft_netdev_hook_alloc(struct net *net, struct nft_hook *hook; int err; - hook = kmalloc(sizeof(struct nft_hook), GFP_KERNEL_ACCOUNT); + hook = kzalloc(sizeof(struct nft_hook), GFP_KERNEL_ACCOUNT); if (!hook) { err = -ENOMEM; goto err_hook_alloc; |