diff options
author | Jean-François Moine <moinejf@free.fr> | 2010-03-07 05:58:55 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-05-18 00:46:28 -0300 |
commit | 24f222e77ad62e41b1a882c77feeb8268c80b909 (patch) | |
tree | aecbfa66ccb227637620e322b76e43d0f0884bbd | |
parent | 52897d86b1f0c8639e4b132b6b4ab1973694650f (diff) | |
download | op-kernel-dev-24f222e77ad62e41b1a882c77feeb8268c80b909.zip op-kernel-dev-24f222e77ad62e41b1a882c77feeb8268c80b909.tar.gz |
V4L/DVB: gspca - t613: Check the result of kmalloc
Signed-off-by: Jean-François Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | drivers/media/video/gspca/t613.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/media/video/gspca/t613.c b/drivers/media/video/gspca/t613.c index 668a753..8c7dade 100644 --- a/drivers/media/video/gspca/t613.c +++ b/drivers/media/video/gspca/t613.c @@ -523,6 +523,10 @@ static void reg_w_buf(struct gspca_dev *gspca_dev, u8 *tmpbuf; tmpbuf = kmalloc(len, GFP_KERNEL); + if (!tmpbuf) { + err("Out of memory"); + return; + } memcpy(tmpbuf, buffer, len); usb_control_msg(gspca_dev->dev, usb_sndctrlpipe(gspca_dev->dev, 0), @@ -542,10 +546,15 @@ static void reg_w_ixbuf(struct gspca_dev *gspca_dev, int i; u8 *p, *tmpbuf; - if (len * 2 <= USB_BUF_SZ) + if (len * 2 <= USB_BUF_SZ) { p = tmpbuf = gspca_dev->usb_buf; - else + } else { p = tmpbuf = kmalloc(len * 2, GFP_KERNEL); + if (!tmpbuf) { + err("Out of memory"); + return; + } + } i = len; while (--i >= 0) { *p++ = reg++; |