Re: [PATCH] uvc: kmalloc failure ignored in uvc_ctrl_add_ctrl()

2009-09-24 Thread Laurent Pinchart
Hi Roel, thanks for noticing the problem and providing a patch. Some comments inlined. On Saturday 19 September 2009 03:13:37 Roel Kluin wrote: Produce an error if kmalloc() fails. Signed-off-by: Roel Kluin roel.kl...@gmail.com --- Found with sed: http://kernelnewbies.org/roelkluin

Re: [Linux-uvc-devel] [PATCH] uvc: kmalloc failure ignored in uvc_ctrl_add_ctrl()

2009-09-24 Thread Paulo Assis
Laurent, That's not enough to prevent a kernel crash. The driver can try to dereference ctrl-data if ctrl-info isn't NULL. You should only set ctrl-info if allocationg succeeds. Something like        ctrl-data = kmalloc(ctrl-info-size * UVC_CTRL_NDATA, GFP_KERNEL);        if (ctrl-data ==

[PATCH] uvc: kmalloc failure ignored in uvc_ctrl_add_ctrl()

2009-09-18 Thread Roel Kluin
Produce an error if kmalloc() fails. Signed-off-by: Roel Kluin roel.kl...@gmail.com --- Found with sed: http://kernelnewbies.org/roelkluin Build tested. Please review diff --git a/drivers/media/video/uvc/uvc_ctrl.c b/drivers/media/video/uvc/uvc_ctrl.c index c3225a5..dda80b5 100644 ---