All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Staging: unisys: visornic_main: Replace kzalloc with kcalloc
@ 2015-10-13 15:41 Shivani Bhardwaj
  2015-10-13 15:52 ` [Outreachy kernel] " Shraddha Barke
  0 siblings, 1 reply; 2+ messages in thread
From: Shivani Bhardwaj @ 2015-10-13 15:41 UTC (permalink / raw)
  To: outreachy-kernel

Use kcalloc instead of kzalloc for allocation of array as it prevents
integer overflow.
Semantic patch used:

@@
expression E1,E2,E3;
@@

- kzalloc(E1*sizeof(E2),E3)
+ kcalloc(E1,sizeof(E2),E3)

Signed-off-by: Shivani Bhardwaj <shivanib134@gmail.com>
---
 drivers/staging/unisys/visornic/visornic_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/unisys/visornic/visornic_main.c b/drivers/staging/unisys/visornic/visornic_main.c
index 85c9fec..6db74de 100644
--- a/drivers/staging/unisys/visornic/visornic_main.c
+++ b/drivers/staging/unisys/visornic/visornic_main.c
@@ -1797,8 +1797,8 @@ static int visornic_probe(struct visor_device *dev)
 		goto cleanup_netdev;
 	}
 
-	devdata->rcvbuf = kzalloc(sizeof(struct sk_buff *) *
-				  devdata->num_rcv_bufs, GFP_KERNEL);
+	devdata->rcvbuf = kcalloc(devdata->num_rcv_bufs,
+				  sizeof(struct sk_buff *), GFP_KERNEL);
 	if (!devdata->rcvbuf) {
 		err = -ENOMEM;
 		goto cleanup_rcvbuf;
-- 
2.1.0



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

end of thread, other threads:[~2015-10-13 15:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-13 15:41 [PATCH] Staging: unisys: visornic_main: Replace kzalloc with kcalloc Shivani Bhardwaj
2015-10-13 15:52 ` [Outreachy kernel] " Shraddha Barke

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.