]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
xhci: fix derivation of TRB's DMA address in xhci_log_event Trace Event Class
authorXenia Ragiadakou <burzalodowa@gmail.com>
Mon, 9 Sep 2013 18:03:11 +0000 (21:03 +0300)
committerSarah Sharp <sarah.a.sharp@linux.intel.com>
Mon, 2 Dec 2013 20:59:45 +0000 (12:59 -0800)
This patch fixes the retrieval of the DMA address of the TRB that generated
the event by converting the field[0] (low address bits) and field[1] (high
address bits) to CPU byteorder and then typecasting field[1] to u64 so that
the bitshift will not lead to overflow.
In the original code, the typecasting of le32 to u64 was incorrect and the
subsequent conversion to le64 reverts the low and high address parts.
This bug was found using sparse.

Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
drivers/usb/host/xhci-trace.h

index 20364cc8d2fb92d7e81f6ccdb50526cad2105608..afe093340834a1ebf77510b2c58dfdcfe4f31e3a 100644 (file)
@@ -120,8 +120,8 @@ DECLARE_EVENT_CLASS(xhci_log_event,
        ),
        TP_fast_assign(
                __entry->va = trb_va;
-               __entry->dma = le64_to_cpu(((u64)ev->field[1]) << 32 |
-                                               ev->field[0]);
+               __entry->dma = ((u64)le32_to_cpu(ev->field[1])) << 32 |
+                                       le32_to_cpu(ev->field[0]);
                __entry->status = le32_to_cpu(ev->field[2]);
                __entry->flags = le32_to_cpu(ev->field[3]);
                memcpy(__get_dynamic_array(trb), trb_va,