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 == NULL)
> return -ENOMEM;
>
> ctrl->info = info;
Without reading any code this doesn't seem correct, how can you use
ctrl->info->size if you haven't set ctrl->info yet?
Did you mean something like this:
ctrl->data = kmalloc(info->size * UVC_CTRL_NDATA, GFP_KERNEL);
if (ctrl->data == NULL)
return -ENOMEM;
ctrl->info = info;
Like I said I haven't read the code but this looks better.
Best regards,
Paulo
_______________________________________________
Linux-uvc-devel mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/linux-uvc-devel