Messages in this thread Patch in this message | | | Subject | [PATCH 01/19] [media] uvc_driver: Use kmalloc_array() in uvc_simplify_fraction() | From | SF Markus Elfring <> | Date | Sun, 25 Dec 2016 19:29:46 +0100 |
| |
From: Markus Elfring <elfring@users.sourceforge.net> Date: Sat, 24 Dec 2016 21:10:16 +0100
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> --- drivers/media/usb/uvc/uvc_driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c index 04bf35063c4c..a64b5029f262 100644 --- a/drivers/media/usb/uvc/uvc_driver.c +++ b/drivers/media/usb/uvc/uvc_driver.c @@ -253,7 +253,7 @@ void uvc_simplify_fraction(uint32_t *numerator, uint32_t *denominator, uint32_t x, y, r; unsigned int i, n; - an = kmalloc(n_terms * sizeof *an, GFP_KERNEL); + an = kmalloc_array(n_terms, sizeof(*an), GFP_KERNEL); if (an == NULL) return; -- 2.11.0
| |