mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-05 18:39:59 +00:00
xhci: fix incorrect type in assignment in xhci_count_num_new_endpoints()
The fields 'add_flags' and 'drop_flags' in struct xhci_input_control_ctx have type __le32 and need to be converted to CPU byteorder before being used to derive the number of added endpoints. This bug was found using sparse. This patch is not suitable for stable, since the bug would only be triggered on big endian systems, and the code only runs for Intel xHCI host controllers, which are always integrated into little endian systems. Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com> Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
This commit is contained in:
parent
0d3703be3a
commit
ef73400ca5
1 changed files with 2 additions and 2 deletions
|
@ -1892,8 +1892,8 @@ static u32 xhci_count_num_new_endpoints(struct xhci_hcd *xhci,
|
||||||
* (bit 1). The default control endpoint is added during the Address
|
* (bit 1). The default control endpoint is added during the Address
|
||||||
* Device command and is never removed until the slot is disabled.
|
* Device command and is never removed until the slot is disabled.
|
||||||
*/
|
*/
|
||||||
valid_add_flags = ctrl_ctx->add_flags >> 2;
|
valid_add_flags = le32_to_cpu(ctrl_ctx->add_flags) >> 2;
|
||||||
valid_drop_flags = ctrl_ctx->drop_flags >> 2;
|
valid_drop_flags = le32_to_cpu(ctrl_ctx->drop_flags) >> 2;
|
||||||
|
|
||||||
/* Use hweight32 to count the number of ones in the add flags, or
|
/* Use hweight32 to count the number of ones in the add flags, or
|
||||||
* number of endpoints added. Don't count endpoints that are changed
|
* number of endpoints added. Don't count endpoints that are changed
|
||||||
|
|
Loading…
Reference in a new issue