public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Albert ARIBAUD <albert.u.boot@aribaud.net>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] usb: fix unaligned access in device_qual()
Date: Thu, 27 Jun 2013 12:11:36 +0200	[thread overview]
Message-ID: <20130627121136.0411b3f1@lilith> (raw)
In-Reply-To: <1372320297-16275-1-git-send-email-hs@denx.de>

Hi Heiko,

On Thu, 27 Jun 2013 10:04:57 +0200, Heiko Schocher <hs@denx.de> wrote:

> while playing with dfu, I tapped in an unaligned access
> when doing on the host side a "lsusb -d [vendornr]: -v"
> I get on the board:
> 
> GADGET DRIVER: usb_dnl_dfu
> data abort
> 
>     MAYBE you should read doc/README.arm-unaligned-accesses
> 
> pc : [<8ff71db8>]          lr : [<8ff75aec>]
> sp : 8ef40d18  ip : 00000005     fp : 00000000
> r10: 00000000  r9 : 47401410     r8 : 8ef40f38
> r7 : 8ef4aae8  r6 : 0000000a     r5 : 8ef4ab28  r4 : 8ef4ab80
> r3 : 0000000a  r2 : 00000006     r1 : 00000006  r0 : 8ef4aae8
> Flags: Nzcv  IRQs off  FIQs on  Mode SVC_32
> Resetting CPU ...
> 
> reason is that in the "struct usb_composite_dev" the
> "struct usb_device_descriptor desc;" is on an odd address,
> and this struct gets accessed in
> drivers/usb/gadget/composite.c device_qual()
> 
> Fix it, by align this var "struct desc" fix to an aligned
> address.

Please keep the commit message to a minimum -- what is wrong and how it
is fixed -- and move the rest (context and additional details) after
the commit message separator ('---' below).

> Signed-off-by: Heiko Schocher <hs@denx.de>
> Cc: Marek Vasut <marek.vasut@gmail.com>
> Cc: Samuel Egli <samuel.egli@siemens.com>
> ---
>  include/linux/usb/composite.h | 2 +-
>  1 Datei ge?ndert, 1 Zeile hinzugef?gt(+), 1 Zeile entfernt(-)
> 
> diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h
> index 53cb095..4f76f88 100644
> --- a/include/linux/usb/composite.h
> +++ b/include/linux/usb/composite.h
> @@ -331,7 +331,7 @@ struct usb_composite_dev {
>  	/* private: */
>  	/* internals */
>  	unsigned int			suspended:1;
> -	struct usb_device_descriptor	desc;
> +	struct usb_device_descriptor __aligned(CONFIG_SYS_CACHELINE_SIZE) desc;
>  	struct list_head		configs;
>  	struct usb_composite_driver	*driver;
>  	u8				next_string_id;

Amicalement,
-- 
Albert.

  reply	other threads:[~2013-06-27 10:11 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-27  8:04 [U-Boot] [PATCH] usb: fix unaligned access in device_qual() Heiko Schocher
2013-06-27 10:11 ` Albert ARIBAUD [this message]
2013-06-27 10:26   ` Stefan Roese
2013-06-27 11:25     ` Marek Vasut
2013-06-27 12:06     ` Albert ARIBAUD
2013-06-27 11:26 ` Marek Vasut
2013-06-27 12:06   ` Albert ARIBAUD
2013-06-27 13:23     ` Marek Vasut
2013-06-27 16:52       ` Albert ARIBAUD
2013-07-03 13:30         ` Marek Vasut
2013-07-04 11:50           ` Albert ARIBAUD
2013-07-08 13:06             ` Marek Vasut

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=20130627121136.0411b3f1@lilith \
    --to=albert.u.boot@aribaud.net \
    --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