From patchwork Thu Feb 22 00:08:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pablo Neira Ayuso X-Patchwork-Id: 13566632 X-Patchwork-Delegate: kuba@kernel.org Received: from mail.netfilter.org (mail.netfilter.org [217.70.188.207]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 69DF5AD5C; Thu, 22 Feb 2024 00:08:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.188.207 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708560536; cv=none; b=oJ2FJICBGbzcqVoCR03C/5nZxbzpbcBRNGnUNIHqtyLax22Ulz/jsMKxhN8iMCQHJxzhnpEWCz147ejHFXQqDK3trHyGNnL+/g4VMXjeSeAjsJMeiElr3mJnYrlWEBPx4lRFVl636AjvaoohYPJYh+AnCWnv84/r8j8Kry0oZYE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708560536; c=relaxed/simple; bh=UMYkwSuzqq0liqfMIHlSe8GklteBYpV1hDpoBt5D+yM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=UawKlAns7kSzRo1fvqmBONS9U2ojJDokJOx8+DmuJb5Q8WZhdnfPqU+cxioQRHthe8OnpIALWtdOuWwP8mSjhvbjFeXOl2LoSVMAsNav9b5g2aXFYh85My5kdjApKUszxfkg8KmFEo1WT2zYjKv63w9vrDuUQWrYl1/g9gH/V1M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=netfilter.org; spf=pass smtp.mailfrom=netfilter.org; arc=none smtp.client-ip=217.70.188.207 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=netfilter.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=netfilter.org From: Pablo Neira Ayuso To: netfilter-devel@vger.kernel.org Cc: davem@davemloft.net, netdev@vger.kernel.org, kuba@kernel.org, pabeni@redhat.com, edumazet@google.com, fw@strlen.de Subject: [PATCH net 5/5] netfilter: nf_tables: use kzalloc for hook allocation Date: Thu, 22 Feb 2024 01:08:43 +0100 Message-Id: <20240222000843.146665-6-pablo@netfilter.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240222000843.146665-1-pablo@netfilter.org> References: <20240222000843.146665-1-pablo@netfilter.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org From: Florian Westphal 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 Signed-off-by: Pablo Neira Ayuso --- net/netfilter/nf_tables_api.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c index 485e047d5f98..7e938c7397dd 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;