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:
Michael Drake 2017-12-07 19:18:39 +00:00 committed by Greg Kroah-Hartman
parent 9e6d892804
commit 090fd9b7c4

View File

@ -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;