linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
To: Dan Carpenter <dan.carpenter@oracle.com>, Bin Liu <b-liu@ti.com>,
	Felipe Balbi <felipe.balbi@nokia.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-usb@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] usb: musb: tusb6010: uninitialized data in tusb_fifo_write_unaligned()
Date: Wed, 15 Sep 2021 19:49:40 +0200	[thread overview]
Message-ID: <e3ce24c3-477f-5a55-a89a-a0cdff564d8e@wanadoo.fr> (raw)
In-Reply-To: <20210915103659.GB7060@kili>

Le 15/09/2021 à 12:36, Dan Carpenter a écrit :
> This is writing to the first 1 - 3 bytes of "len" and then writing all
> four bytes to musb_writel().  The last byte is always going to be
> garbage.  Zero out the last bytes instead.
> 
> Fixes: 550a7375fe72 ("USB: Add MUSB and TUSB support")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
>   drivers/usb/musb/tusb6010.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/usb/musb/tusb6010.c b/drivers/usb/musb/tusb6010.c
> index c42937692207..c510fb84faa6 100644
> --- a/drivers/usb/musb/tusb6010.c
> +++ b/drivers/usb/musb/tusb6010.c
> @@ -190,6 +190,7 @@ tusb_fifo_write_unaligned(void __iomem *fifo, const u8 *buf, u16 len)
>   	}
>   	if (len > 0) {
>   		/* Write the rest 1 - 3 bytes to FIFO */
> +		len = 0;

+		val = 0;
?

>   		memcpy(&val, buf, len);
>   		musb_writel(fifo, 0, val);
>   	}
> 


CJ

  reply	other threads:[~2021-09-15 17:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-15 10:36 [PATCH] usb: musb: tusb6010: uninitialized data in tusb_fifo_write_unaligned() Dan Carpenter
2021-09-15 17:49 ` Christophe JAILLET [this message]
2021-09-16  7:46   ` Dan Carpenter

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=e3ce24c3-477f-5a55-a89a-a0cdff564d8e@wanadoo.fr \
    --to=christophe.jaillet@wanadoo.fr \
    --cc=b-liu@ti.com \
    --cc=dan.carpenter@oracle.com \
    --cc=felipe.balbi@nokia.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).