netfilter: nfnl_cthelper: Replace kzalloc with kcalloc

Message ID 20171012222218.1220-1-harshasharmaiitr@gmail.com
State Changes Requested
Delegated to: Pablo Neira
Headers show
Series
  • netfilter: nfnl_cthelper: Replace kzalloc with kcalloc
Related show

Commit Message

Harsha Sharma Oct. 12, 2017, 10:22 p.m.
kcalloc is preferred to allocate an array instead of kzalloc.
This patch fixes checkpatch isssue.

Signed-off-by: Harsha Sharma <harshasharmaiitr@gmail.com>
---
 net/netfilter/nfnetlink_cthelper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Florian Westphal Oct. 12, 2017, 11:42 p.m. | #1
Harsha Sharma <harshasharmaiitr@gmail.com> wrote:
> kcalloc is preferred to allocate an array instead of kzalloc.
> This patch fixes checkpatch isssue.
> 
> Signed-off-by: Harsha Sharma <harshasharmaiitr@gmail.com>
> ---
>  net/netfilter/nfnetlink_cthelper.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/netfilter/nfnetlink_cthelper.c b/net/netfilter/nfnetlink_cthelper.c
> index 41628b393673..f1ce335b9158 100644
> --- a/net/netfilter/nfnetlink_cthelper.c
> +++ b/net/netfilter/nfnetlink_cthelper.c
> @@ -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.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/net/netfilter/nfnetlink_cthelper.c b/net/netfilter/nfnetlink_cthelper.c
index 41628b393673..f1ce335b9158 100644
--- a/net/netfilter/nfnetlink_cthelper.c
+++ b/net/netfilter/nfnetlink_cthelper.c
@@ -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;