Skip to contentSkip to conversation

netfilter: nfnl_cthelper: Replace kzalloc with kcalloc

PATCH In review Harsha Sharma 2 participants 2 messages Oct 12, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 netfilter: nfnl_cthelper: Replace kzalloc with kcalloc

kcalloc is preferred to allocate an array instead of kzalloc. This patch fixes checkpatch isssue.

---
 net/netfilter/nfnetlink_cthelper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/netfilter/nfnetlink_cthelper.c +1 -1
index 41628b393673..f1ce335b9158 100644
@@ -189,7 +189,7 @@ nfnl_cthelper_parse_expect_policy(struct nf_conntrack_helper *helper,
 	if (class_max > NF_CT_MAX_EXPECT_CLASSES)
 		return -EOVERFLOW;
 
-	expect_policy = kzalloc(sizeof(struct nf_conntrack_expect_policy) *
+	expect_policy = kcalloc(sizeof(struct nf_conntrack_expect_policy) *
 				class_max, GFP_KERNEL);
 	if (expect_policy == NULL)
 		return -ENOMEM;
Signature · 1 line
2.11.0
maintainer
#1 lore raw
Quoted 13 lines · Harsha Sharma

kcalloc is preferred to allocate an array instead of kzalloc. This patch fixes checkpatch isssue.

---
 net/netfilter/nfnetlink_cthelper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/netfilter/nfnetlink_cthelper.c +0 -0
index 41628b393673..f1ce335b9158 100644

net/netfilter/nfnetlink_cthelper.c nfnl_cthelper_parse_expect_policy(struct nf_conntrack_helper *helper, · line 193

Quoted 6 lines
net/netfilter/nfnetlink_cthelper.c +1 -1
@@ -189,7 +189,7 @@ nfnl_cthelper_parse_expect_policy(struct nf_conntrack_helper *helper,
 	if (class_max > NF_CT_MAX_EXPECT_CLASSES)
 		return -EOVERFLOW;
 
-	expect_policy = kzalloc(sizeof(struct nf_conntrack_expect_policy) *
+	expect_policy = kcalloc(sizeof(struct nf_conntrack_expect_policy) *
 				class_max, GFP_KERNEL);

Please at least compile test patches.