Permalink
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...
1 parent 1994341 commit f1c105290f980156ddbbe465e66892b396664b8e Sarah Sharp committed with Sep 10, 2010
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" : "",

0 comments on commit f1c1052

Please sign in to comment.