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
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to