[U-Boot] [PATCH] usb: dwc3: fixes crash in dwc3 driver due to types size mismatch

Ravi Babu ravibabu at ti.com
Thu Jul 21 12:41:06 CEST 2016


The crash at dwc3 driver observed due to offset misalignment
of structure members across files causing wrong code generation
and leads to crash, the issue is found during dfu test.

For instance, ther is is mismatch in code generation to
access the address of structure member dwc->dep[0] in
gadget.c and ep0.c. This leads to NULL pointer reference
casuing the crash. The inclusion of common.h fixes the issue.

The crash occurs due to below commit[1], revert of this patch
resolves the issue.

>>[1] commit 95ebc253e6d4a3370e3dab14743bfc99fcd9cf1b
>>Author: Masahiro Yamada <yamada.masahiro at socionext.com>
>>Date:   Tue Jun 28 10:48:40 2016 +0900

types.h: move and redefine resource_size_t

Currently, this is only defined in arch/arm/include/asm/types.h,
so move it to include/linux/types.h to make it available for all
architectures.

I defined it with phys_addr_t as Linux does.  I needed to surround
the define with #ifdef __KERNEL__ ... #endif to avoid build errors
in tools building.  (Host tools should not include <linux/types.h>
in the first place, but this is already messy in U-Boot...)

>>Signed-off-by: Masahiro Yamada <yamada.masahiro at socionext.com>
>>Reviewed-by: Simon Glass <sjg at chromium.org>

Signed-off-by: Ravi Babu <ravibabu at ti.com>
---
 drivers/usb/dwc3/ep0.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c
index 12b133f..f49a06e 100644
--- a/drivers/usb/dwc3/ep0.c
+++ b/drivers/usb/dwc3/ep0.c
@@ -14,6 +14,7 @@
  * SPDX-License-Identifier:     GPL-2.0
  */
 
+#include <common.h>
 #include <linux/kernel.h>
 #include <linux/list.h>
 
-- 
1.7.9.5



More information about the U-Boot mailing list