mirror of
https://github.com/freebsd/freebsd-src
synced 2024-07-21 18:27:22 +00:00
uhid: Check for errors from copyin() in ioctl handlers
This is in preparation for annotating copyin() and related functions with __result_use_check. Reviewed by: wulf MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D43103
This commit is contained in:
parent
e452fa70d5
commit
b2caed2f8d
|
@ -634,9 +634,10 @@ uhid_ioctl(struct usb_fifo *fifo, u_long cmd, void *addr,
|
|||
return (EINVAL);
|
||||
}
|
||||
if (id != 0)
|
||||
copyin(ugd->ugd_data, &id, 1);
|
||||
error = uhid_get_report(sc, ugd->ugd_report_type, id,
|
||||
NULL, ugd->ugd_data, imin(ugd->ugd_maxlen, size));
|
||||
error = copyin(ugd->ugd_data, &id, 1);
|
||||
if (error == 0)
|
||||
error = uhid_get_report(sc, ugd->ugd_report_type, id,
|
||||
NULL, ugd->ugd_data, imin(ugd->ugd_maxlen, size));
|
||||
break;
|
||||
|
||||
case USB_SET_REPORT:
|
||||
|
@ -661,9 +662,10 @@ uhid_ioctl(struct usb_fifo *fifo, u_long cmd, void *addr,
|
|||
return (EINVAL);
|
||||
}
|
||||
if (id != 0)
|
||||
copyin(ugd->ugd_data, &id, 1);
|
||||
error = uhid_set_report(sc, ugd->ugd_report_type, id,
|
||||
NULL, ugd->ugd_data, imin(ugd->ugd_maxlen, size));
|
||||
error = copyin(ugd->ugd_data, &id, 1);
|
||||
if (error == 0)
|
||||
error = uhid_set_report(sc, ugd->ugd_report_type, id,
|
||||
NULL, ugd->ugd_data, imin(ugd->ugd_maxlen, size));
|
||||
break;
|
||||
|
||||
case USB_GET_REPORT_ID:
|
||||
|
|
|
@ -359,9 +359,10 @@ uhid_snes_ioctl(struct usb_fifo *fifo, u_long cmd, void *data, int fflags)
|
|||
return (EINVAL);
|
||||
}
|
||||
if (id != 0)
|
||||
copyin(ugd->ugd_data, &id, 1);
|
||||
error = uhid_get_report(sc, ugd->ugd_report_type, id,
|
||||
NULL, ugd->ugd_data, imin(ugd->ugd_maxlen, size));
|
||||
error = copyin(ugd->ugd_data, &id, 1);
|
||||
if (error == 0)
|
||||
error = uhid_get_report(sc, ugd->ugd_report_type, id,
|
||||
NULL, ugd->ugd_data, imin(ugd->ugd_maxlen, size));
|
||||
break;
|
||||
|
||||
case USB_SET_REPORT:
|
||||
|
@ -386,9 +387,10 @@ uhid_snes_ioctl(struct usb_fifo *fifo, u_long cmd, void *data, int fflags)
|
|||
return (EINVAL);
|
||||
}
|
||||
if (id != 0)
|
||||
copyin(ugd->ugd_data, &id, 1);
|
||||
error = uhid_set_report(sc, ugd->ugd_report_type, id,
|
||||
NULL, ugd->ugd_data, imin(ugd->ugd_maxlen, size));
|
||||
error = copyin(ugd->ugd_data, &id, 1);
|
||||
if (error == 0)
|
||||
error = uhid_set_report(sc, ugd->ugd_report_type, id,
|
||||
NULL, ugd->ugd_data, imin(ugd->ugd_maxlen, size));
|
||||
break;
|
||||
|
||||
case USB_GET_REPORT_ID:
|
||||
|
|
Loading…
Reference in a new issue