diff options
author | hselasky <hselasky@FreeBSD.org> | 2015-01-20 11:43:16 +0000 |
---|---|---|
committer | hselasky <hselasky@FreeBSD.org> | 2015-01-20 11:43:16 +0000 |
commit | 827c65e7ef3341ba0cd7906e6e8417b2db035566 (patch) | |
tree | 8502d983fedd72baca899ca9b21d0b15446ac2c0 /sys | |
parent | 0cbd82bbb22b8e5786ea4067ef052f4c44ad2963 (diff) | |
download | FreeBSD-src-827c65e7ef3341ba0cd7906e6e8417b2db035566.zip FreeBSD-src-827c65e7ef3341ba0cd7906e6e8417b2db035566.tar.gz |
Fix returned data for the USB_GET_DEV_PORT_PATH IOCTL in particular
the value returned in the "udp_port_level" field.
Reported by: Uffe Jakobsen <uffe@uffe.org>
MFC after: 1 week
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/usb/usb_generic.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/sys/dev/usb/usb_generic.c b/sys/dev/usb/usb_generic.c index 96dfe8b..17956cb 100644 --- a/sys/dev/usb/usb_generic.c +++ b/sys/dev/usb/usb_generic.c @@ -1849,14 +1849,13 @@ ugen_get_port_path(struct usb_fifo *f, struct usb_device_port_path *dpp) if (nlevel > USB_DEVICE_PORT_PATH_MAX) goto error; + /* store total level of ports */ + dpp->udp_port_level = nlevel; + /* store port index array */ next = udev; while (next->parent_hub != NULL) { - nlevel--; - - dpp->udp_port_no[nlevel] = next->port_no; - dpp->udp_port_level = nlevel; - + dpp->udp_port_no[--nlevel] = next->port_no; next = next->parent_hub; } return (0); /* success */ |