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

2009-09-24 Thread Laurent Pinchart
On Thursday 24 September 2009 10:50:39 Paulo Assis wrote: > 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 =

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 (ct