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

Marek Vasut marex at denx.de
Thu Jul 21 13:42:39 CEST 2016


On 07/21/2016 12:41 PM, Ravi Babu wrote:
> 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.

Please explain why this patch fixes the issue.

Make the explanation terse, it took me quite a while to extrapolate the
message from the text.

> 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

No need to include the whole commit message of another commit, just the
subject is enough. Also, I dunno why you add two levels of indent to the
headers of the commit, but not to the subject, this is real confusing.

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


-- 
Best regards,
Marek Vasut


More information about the U-Boot mailing list