mirror of
https://github.com/torvalds/linux.git
synced 2026-05-26 16:12:59 +02:00
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:
parent
648dec6840
commit
8deb1e2a39
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user