[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b8a167bfb3731a665ba54b4fa4ccf899a31d9644.camel@perches.com>
Date: Sat, 10 Aug 2019 14:02:02 -0700
From: Joe Perches <joe@...ches.com>
To: Ben Hutchings <ben@...adent.org.uk>, linux-kernel@...r.kernel.org,
stable@...r.kernel.org
Cc: akpm@...ux-foundation.org, Denis Kirjanov <kda@...ux-powerpc.org>,
Markus Elfring <elfring@...rs.sourceforge.net>,
Jonathan Cameron <jic23@...nel.org>
Subject: Re: [PATCH 3.16 004/157] iio: Use kmalloc_array() in
iio_scan_mask_set()
On Sat, 2019-08-10 at 21:40 +0100, Ben Hutchings wrote:
> 3.16.72-rc1 review patch. If anyone has any objections, please let me know.
Unless to enable applying further patches,
I doubt there is ever a need to have any
of Markus Elfring's patches applied to any
-stable kernel.
> ------------------
>
> From: Markus Elfring <elfring@...rs.sourceforge.net>
>
> commit 057ac1acdfc4743f066fcefe359385cad00549eb upstream.
>
> 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@...rs.sourceforge.net>
> Signed-off-by: Jonathan Cameron <jic23@...nel.org>
> Signed-off-by: Ben Hutchings <ben@...adent.org.uk>
> ---
> drivers/iio/industrialio-buffer.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
> --- a/drivers/iio/industrialio-buffer.c
> +++ b/drivers/iio/industrialio-buffer.c
> @@ -836,10 +836,9 @@ int iio_scan_mask_set(struct iio_dev *in
> 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) {
>
Powered by blists - more mailing lists