kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] IB/usnic: Fine-tuning for two function implementations
@ 2017-04-06 20:08 SF Markus Elfring
       [not found] ` <f0a030a8-2a03-f531-57d8-39c2aeae28a4-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
  2017-04-06 20:10 ` [PATCH 2/2] IB/usnic: Use kcalloc() in usnic_vnic_alloc_res_chunk() SF Markus Elfring
  0 siblings, 2 replies; 3+ messages in thread
From: SF Markus Elfring @ 2017-04-06 20:08 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Christian Benvenuti,
	Dave Goodell, Doug Ledford, Hal Rosenstock, Sean Hefty
  Cc: LKML, kernel-janitors-u79uwXL29TY76Z2rM5mHXA

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 6 Apr 2017 22:00:10 +0200

A few update suggestions were taken into account
from static source code analysis.

Markus Elfring (2):
  Use kcalloc() in alloc_res_chunk_list()
  Use kcalloc() in usnic_vnic_alloc_res_chunk()

 drivers/infiniband/hw/usnic/usnic_ib_qp_grp.c | 4 ++--
 drivers/infiniband/hw/usnic/usnic_vnic.c      | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

-- 
2.12.2


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] IB/usnic: Use kcalloc() in alloc_res_chunk_list()
       [not found] ` <f0a030a8-2a03-f531-57d8-39c2aeae28a4-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
@ 2017-04-06 20:09   ` SF Markus Elfring
  0 siblings, 0 replies; 3+ messages in thread
From: SF Markus Elfring @ 2017-04-06 20:09 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Christian Benvenuti,
	Dave Goodell, Doug Ledford, Hal Rosenstock, Sean Hefty
  Cc: LKML, kernel-janitors-u79uwXL29TY76Z2rM5mHXA

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 6 Apr 2017 20:32:39 +0200

A multiplication for the size determination of a memory allocation
indicated that an array data structure should be processed.
Thus use the corresponding function "kcalloc".

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/infiniband/hw/usnic/usnic_ib_qp_grp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/hw/usnic/usnic_ib_qp_grp.c b/drivers/infiniband/hw/usnic/usnic_ib_qp_grp.c
index 092d4e11a633..817f0475d9fe 100644
--- a/drivers/infiniband/hw/usnic/usnic_ib_qp_grp.c
+++ b/drivers/infiniband/hw/usnic/usnic_ib_qp_grp.c
@@ -545,8 +545,8 @@ alloc_res_chunk_list(struct usnic_vnic *vnic,
 		/* Do Nothing */
 	}
 
-	res_chunk_list = kzalloc(sizeof(*res_chunk_list)*(res_lst_sz+1),
-					GFP_ATOMIC);
+	res_chunk_list = kcalloc(res_lst_sz + 1, sizeof(*res_chunk_list),
+				 GFP_ATOMIC);
 	if (!res_chunk_list)
 		return ERR_PTR(-ENOMEM);
 
-- 
2.12.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] IB/usnic: Use kcalloc() in usnic_vnic_alloc_res_chunk()
  2017-04-06 20:08 [PATCH 0/2] IB/usnic: Fine-tuning for two function implementations SF Markus Elfring
       [not found] ` <f0a030a8-2a03-f531-57d8-39c2aeae28a4-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
@ 2017-04-06 20:10 ` SF Markus Elfring
  1 sibling, 0 replies; 3+ messages in thread
From: SF Markus Elfring @ 2017-04-06 20:10 UTC (permalink / raw)
  To: linux-rdma, Christian Benvenuti, Dave Goodell, Doug Ledford,
	Hal Rosenstock, Sean Hefty
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 6 Apr 2017 21:45:33 +0200

A multiplication for the size determination of a memory allocation
indicated that an array data structure should be processed.
Thus use the corresponding function "kcalloc".

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/infiniband/hw/usnic/usnic_vnic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/infiniband/hw/usnic/usnic_vnic.c b/drivers/infiniband/hw/usnic/usnic_vnic.c
index e7b0030254da..a00bb9940cea 100644
--- a/drivers/infiniband/hw/usnic/usnic_vnic.c
+++ b/drivers/infiniband/hw/usnic/usnic_vnic.c
@@ -312,7 +312,7 @@ static int usnic_vnic_alloc_res_chunk(struct usnic_vnic *vnic,
 	}
 
 	chunk->cnt = chunk->free_cnt = cnt;
-	chunk->res = kzalloc(sizeof(*(chunk->res))*cnt, GFP_KERNEL);
+	chunk->res = kcalloc(cnt, sizeof(*chunk->res), GFP_KERNEL);
 	if (!chunk->res)
 		return -ENOMEM;
 
-- 
2.12.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-04-06 20:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-06 20:08 [PATCH 0/2] IB/usnic: Fine-tuning for two function implementations SF Markus Elfring
     [not found] ` <f0a030a8-2a03-f531-57d8-39c2aeae28a4-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
2017-04-06 20:09   ` [PATCH 1/2] IB/usnic: Use kcalloc() in alloc_res_chunk_list() SF Markus Elfring
2017-04-06 20:10 ` [PATCH 2/2] IB/usnic: Use kcalloc() in usnic_vnic_alloc_res_chunk() SF Markus Elfring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).