summaryrefslogtreecommitdiff
path: root/drivers/staging/iio/accel/lis3l02dq_ring.c
diff options
context:
space:
mode:
authorThomas Meyer <thomas@m3y3r.de>2011-11-29 22:08:00 +0100
committerGreg Kroah-Hartman <gregkh@suse.de>2011-11-30 19:37:33 +0900
commitd83fb184945cd2daaafd33a702bba9cb7ed502bf (patch)
treeeb13dc818416eecbc1a31b564b76fe292021b40d /drivers/staging/iio/accel/lis3l02dq_ring.c
parent201320435d017e8ebd449034547ef0518ec4d056 (diff)
staging: iio: 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. The semantic patch that makes this change is available in https://lkml.org/lkml/2011/11/25/107 Signed-off-by: Thomas Meyer <thomas@m3y3r.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/iio/accel/lis3l02dq_ring.c')
-rw-r--r--drivers/staging/iio/accel/lis3l02dq_ring.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/staging/iio/accel/lis3l02dq_ring.c b/drivers/staging/iio/accel/lis3l02dq_ring.c
index 89527af8f4c5..a90050271204 100644
--- a/drivers/staging/iio/accel/lis3l02dq_ring.c
+++ b/drivers/staging/iio/accel/lis3l02dq_ring.c
@@ -93,8 +93,7 @@ static int lis3l02dq_read_all(struct iio_dev *indio_dev, u8 *rx_array)
struct spi_message msg;
int ret, i, j = 0;
- xfers = kzalloc((buffer->scan_count) * 2
- * sizeof(*xfers), GFP_KERNEL);
+ xfers = kcalloc((buffer->scan_count) * 2, sizeof(*xfers), GFP_KERNEL);
if (!xfers)
return -ENOMEM;