linux-renesas-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Wolfram Sang <wsa@the-dreams.de>
Cc: Biju Das <biju.das@bp.renesas.com>,
	Kishon Vijay Abraham I <kishon@ti.com>,
	Dan Carpenter <dan.carpenter@oracle.com>,
	Wolfram Sang <wsa+renesas@sang-engineering.com>,
	Simon Horman <horms+renesas@verge.net.au>,
	Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>,
	Simon Horman <horms@verge.net.au>,
	Geert Uytterhoeven <geert+renesas@glider.be>,
	Chris Paterson <Chris.Paterson2@renesas.com>,
	Fabrizio Castro <fabrizio.castro@bp.renesas.com>,
	Linux-Renesas <linux-renesas-soc@vger.kernel.org>
Subject: Re: [PATCH] phy: renesas: phy-rcar-gen2: Fix the array off by one warning
Date: Thu, 16 May 2019 14:34:04 +0200	[thread overview]
Message-ID: <CAMuHMdUpqbQ=3hBzt9nYfy-jwSbPQ9kF8Q-org=fecR_RiDN4A@mail.gmail.com> (raw)
In-Reply-To: <20190516121659.GA2832@kunai>

Hi Wolfram,

On Thu, May 16, 2019 at 2:17 PM Wolfram Sang <wsa@the-dreams.de> wrote:
>
> >               error = of_property_read_u32(np, "reg", &channel_num);
> > -             if (error || channel_num > 2) {
> > +             if (error || channel_num > data->last_channel) {
>
> Just an idea, I haven't tested it: Couldn't we use
> ARRAY_SIZE(data->select_value) to avoid the extra member in the struct?

No we can't, as the sizes of the arrays pointed to by the various
SoC-specific structs differ, and at this point in the code, we just have a
pointer, not a fixed-size array. So you cannot use ARRAY_SIZE().

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

  parent reply	other threads:[~2019-05-16 12:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-15 13:43 [PATCH] phy: renesas: phy-rcar-gen2: Fix the array off by one warning Biju Das
2019-05-16 11:13 ` Simon Horman
2019-05-16 12:16 ` Wolfram Sang
2019-05-16 12:32   ` Biju Das
2019-05-16 12:34   ` Geert Uytterhoeven [this message]
2019-05-16 13:25     ` Wolfram Sang
2019-05-16 12:40 ` Geert Uytterhoeven
2019-05-16 13:03   ` Biju Das

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='CAMuHMdUpqbQ=3hBzt9nYfy-jwSbPQ9kF8Q-org=fecR_RiDN4A@mail.gmail.com' \
    --to=geert@linux-m68k.org \
    --cc=Chris.Paterson2@renesas.com \
    --cc=biju.das@bp.renesas.com \
    --cc=dan.carpenter@oracle.com \
    --cc=fabrizio.castro@bp.renesas.com \
    --cc=geert+renesas@glider.be \
    --cc=horms+renesas@verge.net.au \
    --cc=horms@verge.net.au \
    --cc=kishon@ti.com \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=wsa+renesas@sang-engineering.com \
    --cc=wsa@the-dreams.de \
    --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).