Blame SOURCES/0012-netlink_delinearize-Fix-suspicious-calloc-call.patch

195495
From d8322b08998a6945b659078b5cc4bd7423194f70 Mon Sep 17 00:00:00 2001
195495
From: Phil Sutter <phil@nwl.cc>
195495
Date: Fri, 11 Jun 2021 17:02:01 +0200
195495
Subject: [PATCH] netlink_delinearize: Fix suspicious calloc() call
195495
195495
Parameter passed to sizeof() was wrong. While being at it, replace the
195495
whole call with xmalloc_array() which takes care of error checking.
195495
195495
Fixes: 913979f882d13 ("src: add expression handler hashtable")
195495
Signed-off-by: Phil Sutter <phil@nwl.cc>
195495
(cherry picked from commit c4058f96c6a55e4fcd49d4380ac07b5466ec01c0)
195495
Signed-off-by: Phil Sutter <psutter@redhat.com>
195495
---
195495
 src/netlink_delinearize.c | 5 ++---
195495
 1 file changed, 2 insertions(+), 3 deletions(-)
195495
195495
diff --git a/src/netlink_delinearize.c b/src/netlink_delinearize.c
195495
index 7315072284119..152b3e6cf8c65 100644
195495
--- a/src/netlink_delinearize.c
195495
+++ b/src/netlink_delinearize.c
195495
@@ -1732,9 +1732,8 @@ void expr_handler_init(void)
195495
 	unsigned int i;
195495
 	uint32_t hash;
195495
 
195495
-	expr_handle_ht = calloc(NFT_EXPR_HSIZE, sizeof(expr_handle_ht));
195495
-	if (!expr_handle_ht)
195495
-		memory_allocation_error();
195495
+	expr_handle_ht = xmalloc_array(NFT_EXPR_HSIZE,
195495
+				       sizeof(expr_handle_ht[0]));
195495
 
195495
 	for (i = 0; i < array_size(netlink_parsers); i++) {
195495
 		hash = djb_hash(netlink_parsers[i].name) % NFT_EXPR_HSIZE;
195495
-- 
195495
2.31.1
195495