media: usb: use kmalloc_array() to replace kmalloc()
Use kmalloc_array() to replace kmalloc() with multiplication. kmalloc_array() has multiply overflow check, which will be safer. Signed-off-by: Zhang Heng <zhangheng@kylinos.cn> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
This commit is contained in:
@@ -817,8 +817,8 @@ static int cxusb_medion_v_start_streaming(struct vb2_queue *q,
|
||||
* doing a large continuous allocation when (if)
|
||||
* s-g isochronous USB transfers are supported
|
||||
*/
|
||||
streambuf = kmalloc(npackets * CXUSB_VIDEO_PKT_SIZE,
|
||||
GFP_KERNEL);
|
||||
streambuf = kmalloc_array(npackets, CXUSB_VIDEO_PKT_SIZE,
|
||||
GFP_KERNEL);
|
||||
if (!streambuf) {
|
||||
if (i < 2) {
|
||||
ret = -ENOMEM;
|
||||
|
||||
Reference in New Issue
Block a user