]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
[media] winbond-cir: Use kmalloc_array() in wbcir_tx()
authorMarkus Elfring <elfring@users.sourceforge.net>
Fri, 14 Oct 2016 05:19:00 +0000 (02:19 -0300)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Fri, 18 Nov 2016 13:04:29 +0000 (11:04 -0200)
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: David Härdeman <david@hardeman.nu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/rc/winbond-cir.c

index cdcd6e38b2956b091c9fae6fda9dad148d1ac358..8c1f9225d35846006d6d20813031cde94d79caf0 100644 (file)
@@ -658,7 +658,7 @@ wbcir_tx(struct rc_dev *dev, unsigned *b, unsigned count)
        unsigned i;
        unsigned long flags;
 
-       buf = kmalloc(count * sizeof(*b), GFP_KERNEL);
+       buf = kmalloc_array(count, sizeof(*b), GFP_KERNEL);
        if (!buf)
                return -ENOMEM;