Re: [RFC 03/21] xhci: fix incorrect type in assignment in xhci_address_device()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11/14/2013 10:52 PM, Sarah Sharp wrote:
Hi Xenia,

This patch doesn't apply any more either, could you resend when you have
time?

Thanks,
Sarah Sharp

Yes, sure! Do you want me to resend all the patch series or just the individual patches?

regards,
ksenia


On Mon, Sep 09, 2013 at 09:03:08PM +0300, Xenia Ragiadakou wrote:
The field 'dev_info' in struct xhci_slot_ctx has type __le32 and it needs
to be converted to CPU byteorder for the correct retrieval of its subfield
'Context Entries'. This field is used by the trace event 'xhci_address_ctx'
to trace only the contexts of valid endpoints.
This bug was found using sparse.

Signed-off-by: Xenia Ragiadakou <burzalodowa@xxxxxxxxx>
---
  drivers/usb/host/xhci.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index bda0cdf..9f22ddf 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -3762,7 +3762,7 @@ int xhci_address_device(struct usb_hcd *hcd, struct usb_device *udev)
  	xhci_dbg(xhci, "Slot ID %d Input Context:\n", udev->slot_id);
  	xhci_dbg_ctx(xhci, virt_dev->in_ctx, 2);
  	trace_xhci_address_ctx(xhci, virt_dev->in_ctx,
-				slot_ctx->dev_info >> 27);
+				le32_to_cpu(slot_ctx->dev_info) >> 27);
spin_lock_irqsave(&xhci->lock, flags);
  	cmd_trb = xhci->cmd_ring->dequeue;
@@ -3841,7 +3841,7 @@ int xhci_address_device(struct usb_hcd *hcd, struct usb_device *udev)
  	xhci_dbg(xhci, "Slot ID %d Input Context:\n", udev->slot_id);
  	xhci_dbg_ctx(xhci, virt_dev->in_ctx, 2);
  	trace_xhci_address_ctx(xhci, virt_dev->in_ctx,
-				slot_ctx->dev_info >> 27);
+				le32_to_cpu(slot_ctx->dev_info) >> 27);
  	xhci_dbg(xhci, "Slot ID %d Output Context:\n", udev->slot_id);
  	xhci_dbg_ctx(xhci, virt_dev->out_ctx, 2);
  	/*
@@ -3850,7 +3850,7 @@ int xhci_address_device(struct usb_hcd *hcd, struct usb_device *udev)
  	 */
  	slot_ctx = xhci_get_slot_ctx(xhci, virt_dev->out_ctx);
  	trace_xhci_address_ctx(xhci, virt_dev->out_ctx,
-				slot_ctx->dev_info >> 27);
+				le32_to_cpu(slot_ctx->dev_info) >> 27);
  	/* Use kernel assigned address for devices; store xHC assigned
  	 * address locally. */
  	virt_dev->address = (le32_to_cpu(slot_ctx->dev_state) & DEV_ADDR_MASK)
--
1.8.3.4


--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux