gregkh / usbutils

USB utilities for Linux, including lsusb
http://www.linux-usb.org
354 stars 199 forks source link

lsusb: fix incorrect variable type and unalignments when dumping hid … #163

Closed naruto-abc closed 1 year ago

naruto-abc commented 1 year ago

First issue, I found there is a weird line:

HID Device Descriptor

This because an unsigned int type is used to hold a potential negative value. In order to fix it, I change some variable type to int. I think int type is also safe to hold the values without overflow. After fixing it:

bLength

Second issue, an unalignment for string "Report Descriptors":

HID Device Descriptor

After fixing it:

HID Device Descriptor
gregkh commented 1 year ago

Can you split this into 2 different patches, one that does one thing, and the other doing the other? A good change should only do one thing at a time, making it easier to review and understand.

naruto-abc commented 1 year ago

Hi Greg,

I've split it into two commits and added more explanation for each one. You can still refer to the screenshots in this pull request, which is more straightforward to show the effects.

gregkh commented 1 year ago

Thanks for the fixes, looks good.