Re: possible missing error handling in hidraw

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am Freitag, 27. April 2012, 09:47:55 schrieb Jiri Kosina:
> -void hidraw_report_event(struct hid_device *hid, u8 *data, int len)
> +int hidraw_report_event(struct hid_device *hid, u8 *data, int len)
>  {
>         struct hidraw *dev = hid->hidraw;
>         struct hidraw_list *list;
> +       int ret = 0;
>  
>         list_for_each_entry(list, &dev->list, node) {
> -               list->buffer[list->head].value = kmemdup(data, len, GFP_ATOMIC);
> +               if (!(list->buffer[list->head].value = kmemdup(data, len, GFP_ATOMIC))) {
> +                       ret = -ENOMEM;
> +                       break;
> +               }
>                 list->buffer[list->head].len = len;
>                 list->head = (list->head + 1) & (HIDRAW_BUFFER_SIZE - 1);
>                 kill_fasync(&list->fasync, SIGIO, POLL_IN);
>         }
>  
>         wake_up_interruptible(&dev->wait);
> +       return ret;
>  }

Then I have to ask why not simply copy the rest of the entries?

	Regards
		Oliver
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux