From: Karl Mehltretter <kmehltretter@gmail.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>,
linux-usb@vger.kernel.org, linux-sh@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] usb: r8a66597-hcd: fix buffer overflow on odd-length FIFO reads
Date: Mon, 5 Oct 2026 06:25:46 +0200 [thread overview]
Message-ID: <asMl-yIKQoAbpwzA@gmail.com> (raw)
In-Reply-To: <CAMuHMdWEYkBra+3G_+-TfT23BAWPxG5o2KHqGRuHcdp8x0Vskg@mail.gmail.com>
Hi Geert,
On Sat, Oct 03, 2026 at 02:42:48PM +0100, Geert Uytterhoeven wrote:
> > + count = len / 2;
> > + ioread16_rep(fifoaddr, buf, count);
>
> Or just:
>
> ioread16_rep(fifoaddr, buf, len / 2);
>
> > +
> > + if (len & 0x00000001) {
>
> "len & 1"?
>
Thanks for suggesting that! I will use len / 2 and len & 1, and a
plain byte store instead of the memcpy().
>
> Seriously: a *_rep() function for a single iteration?
>
I'd like to keep this one. ioread16_rep() does not byte swap.
ioread16() goes through readw(), which swaps on big endian on most
architectures.
The words before the last one are read with ioread16_rep(), so reading
the last word the same way puts its first FIFO byte first in memory on
every architecture.
Thanks,
Karl
next prev parent reply other threads:[~2026-10-05 4:25 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-02 21:32 [PATCH] usb: r8a66597-hcd: fix buffer overflow on odd-length FIFO reads Karl Mehltretter
2026-10-03 7:29 ` John Paul Adrian Glaubitz
2026-10-03 12:42 ` Geert Uytterhoeven
2026-10-05 4:25 ` Karl Mehltretter [this message]
2026-10-05 13:57 ` Geert Uytterhoeven
2026-10-05 20:21 ` Karl Mehltretter
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=asMl-yIKQoAbpwzA@gmail.com \
--to=kmehltretter@gmail.com \
--cc=geert@linux-m68k.org \
--cc=glaubitz@physik.fu-berlin.de \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sh@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.