From: Marek Vasut <marex@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] usb: dwc3: fixes crash in dwc3 driver due to types size mismatch
Date: Thu, 21 Jul 2016 14:54:33 +0200 [thread overview]
Message-ID: <c3b7cd5f-467e-9140-69cf-02e293affd47@denx.de> (raw)
In-Reply-To: <6C6B28D4DC342643927BEAFCE8707BF67629D5AC@DBDE04.ent.ti.com>
On 07/21/2016 02:44 PM, B, Ravi wrote:
> Hi Marek
>
>>>> Please explain why this patch fixes the issue.
>>>
>>> Ok I will explain, due to the commit[1] the resource_size_t size has increased to 8 bytes (64 bit), compared to earlier 32 bit (4bytes) and the definition is moved to includes/linux/types.h from asm.h. Due to this change the code generated in gadget.c is correct, due >to inclusion of right header file (common.h, which includes linux/types.h). Whereas, the ep0.c does not includes common.h, hence size of resources_size_t is 4 bytes, causing wrong offset code generated for structure members which includes resource_size_t, which >leads to pointing to wrong offset location causing the crash.
>
>> This stuff should be in the commit message. Still, git grep resource_size_t does not show that it's used in gadget.c , so I don't understand how this patch can fix things.
>
> Thanks, I will add this text to commit message. The resource_size_t is used in dwc3 structure
> defined in drivers/usb/dwc3/core.h
>
> struct dwc3 {
> ....
> struct resource xhci_resource[DWC3_XHCI_RESOURCES_NUM];
> ..
> };
> The resource structure defined in include/linux/ioport.h
> struct resource {
> resource_size_t start;
> resource_size_t end;
> }
OK, I am starting to get a better picture of this issue.
But somehow I suspect there is a deeper problem with the
includes -- how is it possible that the compiler didn't
complain about the resource_size_t being undefined, but
instead used (incorrectly sized) variant ?
>> Also, please fix your mailer to break at 80 chars per line.
>
> Sure.
>
> Regards
> Ravi
>
--
Best regards,
Marek Vasut
next prev parent reply other threads:[~2016-07-21 12:54 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-21 10:41 [U-Boot] [PATCH] usb: dwc3: fixes crash in dwc3 driver due to types size mismatch Ravi Babu
2016-07-21 11:42 ` Marek Vasut
2016-07-21 12:29 ` B, Ravi
2016-07-21 12:35 ` Marek Vasut
2016-07-21 12:44 ` B, Ravi
2016-07-21 12:54 ` Marek Vasut [this message]
2016-07-21 13:03 ` B, Ravi
2016-07-21 13:05 ` Marek Vasut
2016-07-22 5:10 ` Masahiro Yamada
2016-07-22 8:06 ` B, Ravi
2016-07-22 10:19 ` Marek Vasut
2016-07-22 11:55 ` Tom Rini
2016-07-26 12:59 ` B, Ravi
2016-07-26 13:04 ` Tom Rini
2016-07-26 13:16 ` B, Ravi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c3b7cd5f-467e-9140-69cf-02e293affd47@denx.de \
--to=marex@denx.de \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox