staging: octeon-usb: Replace kmalloc with kmalloc_array
authorCristina Moraru <cristina.moraru09@gmail.com>
Wed, 21 Oct 2015 17:00:50 +0000 (20:00 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 25 Oct 2015 02:28:52 +0000 (19:28 -0700)
Replace kmalloc with specialized function kmalloc_array
when the size is a multiplication of:
number_of_elements * size_of_element

Signed-off-by: Cristina Moraru <cristina.moraru09@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/octeon-usb/octeon-hcd.c

index 61940284311c4e4b990006b8725ca7d1752d13b3..6f2871784ba5955548a7b5f0b2797e22bc5ef109 100644 (file)
@@ -3216,9 +3216,9 @@ static int octeon_usb_urb_enqueue(struct usb_hcd *hcd,
                 * Allocate a structure to use for our private list of
                 * isochronous packets.
                 */
-               iso_packet = kmalloc(urb->number_of_packets *
-                                    sizeof(struct cvmx_usb_iso_packet),
-                                    GFP_ATOMIC);
+               iso_packet = kmalloc_array(urb->number_of_packets,
+                                          sizeof(struct cvmx_usb_iso_packet),
+                                          GFP_ATOMIC);
                if (iso_packet) {
                        int i;
                        /* Fill the list with the data from the URB */