linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Cc: Kishon Vijay Abraham I <kishon@ti.com>,
	Pavel Machek <pavel@denx.de>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linux-Renesas <linux-renesas-soc@vger.kernel.org>,
	stable <stable@vger.kernel.org>
Subject: Re: [PATCH] phy: renesas: rcar-gen3-usb2: Fix sysfs interface of "role"
Date: Wed, 31 Jul 2019 12:09:48 +0200	[thread overview]
Message-ID: <CAMuHMdXyUEHAPYyBN=m6YwCS8129nD3q8Hi4Vh0fvpDwyHNWhw@mail.gmail.com> (raw)
In-Reply-To: <TYAPR01MB4544CFAACC4C81316CF0760DD8DF0@TYAPR01MB4544.jpnprd01.prod.outlook.com>

Hi Shimoda-san,

On Wed, Jul 31, 2019 at 11:58 AM Yoshihiro Shimoda
<yoshihiro.shimoda.uh@renesas.com> wrote:
> > From: Geert Uytterhoeven, Sent: Wednesday, July 31, 2019 6:27 PM
> > On Wed, Jul 31, 2019 at 11:04 AM Yoshihiro Shimoda
> > <yoshihiro.shimoda.uh@renesas.com> wrote:
> > > Since the role_store() uses strncmp(), it's possible to refer
> > > out-of-memory if the sysfs data size is smaller than strlen("host").
> > > This patch fixes it by using sysfs_streq() instead of strncmp().
> > >
> > > Reported-by: Pavel Machek <pavel@denx.de>
> > > Fixes: 9bb86777fb71 ("phy: rcar-gen3-usb2: add sysfs for usb role swap")
> > > Cc: <stable@vger.kernel.org> # v4.10+
> > > Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
> >
> > Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
>
> Thank you for your review!
>
> > > ---
> > >  Just a record. The role_store() doesn't need to check the count because
> > >  the sysfs_streq() checks the first argument is NULL or not.
> >
> > Is that wat you mean? sysfs_streq() doesn't seem to check for NULL pointers.
>
> Oops, sorry for unclear. I meant a NULL-terminated string, not NULL pointer.

OK.

> > Isn't the real reason that sysfs (kernfs) guarantees that the passed buffer
> > is NUL-terminated?
>
> I doesn't check in detail, but I assume so.

I have checked that recently, so it is OK.

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

  reply	other threads:[~2019-07-31 10:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-31  9:01 [PATCH] phy: renesas: rcar-gen3-usb2: Fix sysfs interface of "role" Yoshihiro Shimoda
2019-07-31  9:27 ` Geert Uytterhoeven
2019-07-31  9:58   ` Yoshihiro Shimoda
2019-07-31 10:09     ` Geert Uytterhoeven [this message]
2019-08-14  8:21 ` Pavel Machek

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='CAMuHMdXyUEHAPYyBN=m6YwCS8129nD3q8Hi4Vh0fvpDwyHNWhw@mail.gmail.com' \
    --to=geert@linux-m68k.org \
    --cc=kishon@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=pavel@denx.de \
    --cc=stable@vger.kernel.org \
    --cc=yoshihiro.shimoda.uh@renesas.com \
    /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).