Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

usbutils: Fix bug in link state description printing.

There are only 12 elements in the link_state_descriptions array, so
indexing in using 0xBF (191) is not going to work.

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information...
commit f1c105290f980156ddbbe465e66892b396664b8e 1 parent 1994341
Sarah Sharp authored committed
Showing with 2 additions and 1 deletion.
  1. +2 −1  lsusb.c
View
3  lsusb.c
@@ -3246,7 +3246,8 @@ static void do_hub(struct usb_dev_handle *fd, unsigned tt_type, unsigned speed)
((status[1] & 0x1C) == 0) ? " 5Gbps" : " Unknown Speed",
(status[1] & 0x02) ? " power" : "");
/* Link state is bits 8:5 */
- if (link_state < 0xC0)
+ if (link_state < (sizeof(link_state_descriptions) /
+ sizeof(*link_state_descriptions)))
printf("%s", link_state_descriptions[link_state]);
printf("%s%s%s%s\n",
(status[0] & 0x10) ? " RESET" : "",
Please sign in to comment.
Something went wrong with that request. Please try again.