mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usbutils.git
synced 2024-11-15 06:53:43 +08:00
lsusb: Fix array entry count for variable sized entries.
This fixes a divide by zero which happened when an array, without an explicit entry count (ultimately calculated from the value in the descriptor data's bLength field) was used on field with a variable size. The solultion is to use the get_entry_size() function on the array entry, which can get the entry size from a referenced field. Signed-off-by: Michael Drake <michael.drake@codethink.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
9e6d892804
commit
090fd9b7c4
@ -423,7 +423,7 @@ static unsigned int get_array_entry_count(
|
||||
}
|
||||
}
|
||||
|
||||
entries = size / array_entry->size;
|
||||
entries = size / get_entry_size(buf, desc, array_entry);
|
||||
}
|
||||
|
||||
return entries;
|
||||
|
Loading…
Reference in New Issue
Block a user