Commit 24f222e7 authored by Jean-François Moine's avatar Jean-François Moine Committed by Mauro Carvalho Chehab

V4L/DVB: gspca - t613: Check the result of kmalloc

Signed-off-by: default avatarJean-François Moine <moinejf@free.fr>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 52897d86
...@@ -523,6 +523,10 @@ static void reg_w_buf(struct gspca_dev *gspca_dev, ...@@ -523,6 +523,10 @@ static void reg_w_buf(struct gspca_dev *gspca_dev,
u8 *tmpbuf; u8 *tmpbuf;
tmpbuf = kmalloc(len, GFP_KERNEL); tmpbuf = kmalloc(len, GFP_KERNEL);
if (!tmpbuf) {
err("Out of memory");
return;
}
memcpy(tmpbuf, buffer, len); memcpy(tmpbuf, buffer, len);
usb_control_msg(gspca_dev->dev, usb_control_msg(gspca_dev->dev,
usb_sndctrlpipe(gspca_dev->dev, 0), usb_sndctrlpipe(gspca_dev->dev, 0),
...@@ -542,10 +546,15 @@ static void reg_w_ixbuf(struct gspca_dev *gspca_dev, ...@@ -542,10 +546,15 @@ static void reg_w_ixbuf(struct gspca_dev *gspca_dev,
int i; int i;
u8 *p, *tmpbuf; u8 *p, *tmpbuf;
if (len * 2 <= USB_BUF_SZ) if (len * 2 <= USB_BUF_SZ) {
p = tmpbuf = gspca_dev->usb_buf; p = tmpbuf = gspca_dev->usb_buf;
else } else {
p = tmpbuf = kmalloc(len * 2, GFP_KERNEL); p = tmpbuf = kmalloc(len * 2, GFP_KERNEL);
if (!tmpbuf) {
err("Out of memory");
return;
}
}
i = len; i = len;
while (--i >= 0) { while (--i >= 0) {
*p++ = reg++; *p++ = reg++;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment