> From: linux-input-owner@xxxxxxxxxxxxxxx > [mailto:linux-input-owner@xxxxxxxxxxxxxxx] On Behalf Of 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; > } > What happens if there is more than 1 element in the list and kmemdup fails halfway through the list? Will the allocated memory leak the next time hirdaw_report_event() is called? James -- 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