summaryrefslogtreecommitdiffstats
path: root/drivers/staging/iio/iio_simple_dummy.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/iio_simple_dummy.c
parent201320435d017e8ebd449034547ef0518ec4d056 (diff)
downloadlinux-d83fb184945cd2daaafd33a702bba9cb7ed502bf.tar.bz2
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/iio_simple_dummy.c')
-rw-r--r--drivers/staging/iio/iio_simple_dummy.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/staging/iio/iio_simple_dummy.c b/drivers/staging/iio/iio_simple_dummy.c
index 228f991d40ec..e3a94572bb40 100644
--- a/drivers/staging/iio/iio_simple_dummy.c
+++ b/drivers/staging/iio/iio_simple_dummy.c
@@ -518,7 +518,8 @@ static __init int iio_dummy_init(void)
return -EINVAL;
}
/* Fake a bus */
- iio_dummy_devs = kzalloc(sizeof(*iio_dummy_devs)*instances, GFP_KERNEL);
+ iio_dummy_devs = kcalloc(instances, sizeof(*iio_dummy_devs),
+ GFP_KERNEL);
/* Here we have no actual device so call probe */
for (i = 0; i < instances; i++) {
ret = iio_dummy_probe(i);