public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Lukasz Majewski <l.majewski@samsung.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/3] usb:g_dnl:f_thor: remove memset before memcpy
Date: Tue, 10 Jun 2014 08:50:31 +0200	[thread overview]
Message-ID: <20140610085031.256beeff@amdc2363> (raw)
In-Reply-To: <1402320540-17058-2-git-send-email-jeroen@myspectrum.nl>

Hi Jeroen,

> since ALLOC_CACHE_ALIGN_BUFFER defines a pointer and not a
> buffer, the memset with sizeof(rqt) likely does something else
> then intended. Since there is a memcpy directly after it with
> the full size, drop the memset completely.

Acked-by: Lukasz Majewski <l.majewski@samsung.com>

> 
> Cc: Lukasz Majewski <l.majewski@samsung.com>
> Cc: Marek Vasut <marex@denx.de>
> Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
> ---
>  drivers/usb/gadget/f_thor.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/usb/gadget/f_thor.c b/drivers/usb/gadget/f_thor.c
> index 28f215e..4e06273 100644
> --- a/drivers/usb/gadget/f_thor.c
> +++ b/drivers/usb/gadget/f_thor.c
> @@ -306,7 +306,6 @@ static int process_data(void)
>  	ALLOC_CACHE_ALIGN_BUFFER(struct rqt_box, rqt, sizeof(struct
> rqt_box)); int ret = -EINVAL;
>  
> -	memset(rqt, 0, sizeof(rqt));
>  	memcpy(rqt, thor_rx_data_buf, sizeof(struct rqt_box));
>  
>  	debug("+RQT: %d, %d\n", rqt->rqt, rqt->rqt_data);


-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group

  reply	other threads:[~2014-06-10  6:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-09 13:28 [U-Boot] [PATCH 0/3] fix clang warnings about sizeof usage Jeroen Hofstee
2014-06-09 13:28 ` [U-Boot] [PATCH 1/3] usb:g_dnl:f_thor: remove memset before memcpy Jeroen Hofstee
2014-06-10  6:50   ` Lukasz Majewski [this message]
2014-06-09 13:28 ` [U-Boot] [PATCH 2/3] usb:composite: clear the whole common buffer Jeroen Hofstee
2014-06-09 17:59   ` Marek Vasut
2014-06-10  6:47   ` Lukasz Majewski
2014-06-09 13:29 ` [U-Boot] [PATCH 3/3] ext4: correctly zero filename Jeroen Hofstee
2014-06-09 17:58   ` Marek Vasut
2014-06-11 22:19   ` [U-Boot] [U-Boot,3/3] " Tom Rini

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=20140610085031.256beeff@amdc2363 \
    --to=l.majewski@samsung.com \
    --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