Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e22a3b34 authored by Insu Yun's avatar Insu Yun Committed by Mauro Carvalho Chehab
Browse files

[media] usbtv: correctly handling failed allocation



Since kzalloc can be failed,
if not properly handled, NULL dereference could be happened.

Signed-off-by: default avatarInsu Yun <wuninsu@gmail.com>
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent f8433226
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -393,6 +393,10 @@ static struct urb *usbtv_setup_iso_transfer(struct usbtv *usbtv)
	ip->transfer_flags = URB_ISO_ASAP;
	ip->transfer_buffer = kzalloc(size * USBTV_ISOC_PACKETS,
						GFP_KERNEL);
	if (!ip->transfer_buffer) {
		usb_free_urb(ip);
		return NULL;
	}
	ip->complete = usbtv_iso_cb;
	ip->number_of_packets = USBTV_ISOC_PACKETS;
	ip->transfer_buffer_length = size * USBTV_ISOC_PACKETS;