From: Shraddha Barke Date: Fri, 9 Oct 2015 15:33:28 +0000 (+0530) Subject: Staging: unisys: Use kcalloc instead of kzalloc to allocate array X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=5e757bc58d15b9fc7d36bb4fcc6f068489e2d29d;p=deliverable%2Flinux.git Staging: unisys: Use kcalloc instead of kzalloc to allocate array The advantage of kcalloc is, that will prevent integer overflows which could result from the multiplication of number of elements and size and it is also a bit nicer to read. Signed-off-by: Shraddha Barke Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/unisys/visornic/visornic_main.c b/drivers/staging/unisys/visornic/visornic_main.c index 85c9fec6549e..6db74ded184c 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;