From: Marek Vasut <marex@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH RFC V1 06/18] usb: gadget: config: fix unaligned access issues
Date: Wed, 17 Jul 2013 05:05:17 +0200 [thread overview]
Message-ID: <201307170505.18043.marex@denx.de> (raw)
In-Reply-To: <1374007666-2749-7-git-send-email-troy.kisky@boundarydevices.com>
Dear Troy Kisky,
Missing commit message :-(
> Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
> ---
> drivers/usb/gadget/config.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/usb/gadget/config.c b/drivers/usb/gadget/config.c
> index f9163a8..a4cb5ad 100644
> --- a/drivers/usb/gadget/config.c
> +++ b/drivers/usb/gadget/config.c
> @@ -22,6 +22,7 @@
> */
>
> #include <common.h>
> +#include <asm/unaligned.h>
> #include <asm/errno.h>
> #include <linux/list.h>
> #include <linux/string.h>
> @@ -98,7 +99,8 @@ int usb_gadget_config_buf(
> /* config descriptor first */
> if (length < USB_DT_CONFIG_SIZE || !desc)
> return -EINVAL;
> - *cp = *config;
> + /* config need not be aligned */
> + memcpy(cp, config, sizeof(*cp));
>
> /* then interface/endpoint/class/vendor/... */
> len = usb_descriptor_fillbuf(USB_DT_CONFIG_SIZE + (u8 *)buf,
> @@ -112,7 +114,7 @@ int usb_gadget_config_buf(
> /* patch up the config descriptor */
> cp->bLength = USB_DT_CONFIG_SIZE;
> cp->bDescriptorType = USB_DT_CONFIG;
> - cp->wTotalLength = cpu_to_le16(len);
> + put_unaligned_le16(len, &cp->wTotalLength);
> cp->bmAttributes |= USB_CONFIG_ATT_ONE;
> return len;
> }
Best regards,
Marek Vasut
next prev parent reply other threads:[~2013-07-17 3:05 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-16 20:47 [U-Boot] [PATCH RFC V1 00/18] Make mv_udc work for i.mx6 Troy Kisky
2013-07-16 20:47 ` [U-Boot] [PATCH RFC V1 01/18] Add functions for use with i.mx6 otg udc Troy Kisky
2013-07-16 20:47 ` [U-Boot] [PATCH RFC V1 02/18] mx6: iomux: add GPR1 defines Troy Kisky
2013-07-16 20:47 ` [U-Boot] [PATCH RFC V1 03/18] mx6: define OTG_BASE_ADDR Troy Kisky
2013-07-17 3:05 ` Marek Vasut
2013-07-16 20:47 ` [U-Boot] [PATCH RFC V1 04/18] nitrogen6x: add otg usb ethernet gadget support Troy Kisky
2013-07-16 20:47 ` [U-Boot] [PATCH RFC V1 05/18] nitrogen6x: add CONFIG_MV_UDC Troy Kisky
2013-07-16 20:47 ` [U-Boot] [PATCH RFC V1 06/18] usb: gadget: config: fix unaligned access issues Troy Kisky
2013-07-17 3:05 ` Marek Vasut [this message]
2013-07-16 20:47 ` [U-Boot] [PATCH RFC V1 07/18] usb: gadget: mv_udc: set udc after controller.udc is initialized Troy Kisky
2013-07-16 20:47 ` [U-Boot] [PATCH RFC V1 08/18] usb: gadget: mv_udc: add MX6Q specific reset Troy Kisky
2013-07-16 20:47 ` [U-Boot] [PATCH RFC V1 09/18] usb: gadget: ether set wMaxPacketSize Troy Kisky
2013-07-16 20:47 ` [U-Boot] [PATCH RFC V1 10/18] usb: gadget: ether: return error from rx_submit if no request Troy Kisky
2013-07-17 0:28 ` Troy Kisky
2013-07-16 20:47 ` [U-Boot] [PATCH RFC V1 11/18] usb: gadget: mv_udc: split mv_udc.h file Troy Kisky
2013-07-16 20:47 ` [U-Boot] [PATCH RFC V1 12/18] usb: udc: add udc.h include file Troy Kisky
2013-07-16 20:47 ` [U-Boot] [PATCH RFC V1 13/18] usb: gadget: mv_udc: fix typo in error message Troy Kisky
2013-07-16 20:47 ` [U-Boot] [PATCH RFC V1 14/18] usb: gadget: mv_udc: use static initialization of ops, udc Troy Kisky
2013-07-16 20:47 ` [U-Boot] [PATCH RFC V1 15/18] usb: gadget: mv_udc: set is_dualspeed = 1 Troy Kisky
2013-07-16 20:47 ` [U-Boot] [PATCH RFC V1 16/18] usb: gadget: mv_udc: fix full speed connections Troy Kisky
2013-07-16 20:47 ` [U-Boot] [PATCH RFC V1 17/18] usb: gadget: mv_udc: fix cache issues Troy Kisky
2013-07-16 20:47 ` [U-Boot] [PATCH RFC V1 18/18] usb: gadget: mv_udc: clear desc upon ep_disable Troy Kisky
2013-07-17 3:04 ` [U-Boot] [PATCH RFC V1 00/18] Make mv_udc work for i.mx6 Marek Vasut
2013-07-17 17:34 ` Troy Kisky
2013-07-17 18:04 ` 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=201307170505.18043.marex@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