diff options
author | Markus Elfring <elfring@users.sourceforge.net> | 2016-09-23 22:30:32 +0200 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2016-09-24 17:35:24 +0200 |
commit | 057ac1acdfc4743f066fcefe359385cad00549eb (patch) | |
tree | b5fd619aef3a8ec7bb216422b424c0cf5ceb114d /drivers/iio/industrialio-buffer.c | |
parent | iio: accel: mma7660: fix non static symbol warning (diff) | |
download | linux-057ac1acdfc4743f066fcefe359385cad00549eb.tar.xz linux-057ac1acdfc4743f066fcefe359385cad00549eb.zip |
iio: Use kmalloc_array() in iio_scan_mask_set()
A multiplication for the size determination of a memory allocation
indicated that an array data structure should be processed.
Thus use the corresponding function "kmalloc_array".
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio/industrialio-buffer.c')
-rw-r--r-- | drivers/iio/industrialio-buffer.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c index 158aaf44dd95..b12830b09c7d 100644 --- a/drivers/iio/industrialio-buffer.c +++ b/drivers/iio/industrialio-buffer.c @@ -307,10 +307,9 @@ static int iio_scan_mask_set(struct iio_dev *indio_dev, const unsigned long *mask; unsigned long *trialmask; - trialmask = kmalloc(sizeof(*trialmask)* - BITS_TO_LONGS(indio_dev->masklength), - GFP_KERNEL); - + trialmask = kmalloc_array(BITS_TO_LONGS(indio_dev->masklength), + sizeof(*trialmask), + GFP_KERNEL); if (trialmask == NULL) return -ENOMEM; if (!indio_dev->masklength) { |