From: Biju Das <biju.das@bp.renesas.com>
To: Wolfram Sang <wsa@the-dreams.de>
Cc: 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-soc@vger.kernel.org"
<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 12:32:08 +0000 [thread overview]
Message-ID: <OSBPR01MB21031BCDA0AEBD7A6EE6E9A9B80A0@OSBPR01MB2103.jpnprd01.prod.outlook.com> (raw)
In-Reply-To: <20190516121659.GA2832@kunai>
Hi Wolfram,
Thanks for the feedback.
> Subject: Re: [PATCH] phy: renesas: phy-rcar-gen2: Fix the array off by one
> warning
>
> > 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?
I checked this now. It is giving the below build errors
In file included from ./include/linux/kernel.h:16:0,
from ./include/linux/clk.h:16,
from drivers/phy/renesas/phy-rcar-gen2.c:10:
drivers/phy/renesas/phy-rcar-gen2.c: In function 'rcar_gen2_phy_probe':
./include/linux/build_bug.h:16:45: error: negative width in bit-field '<anonymous>'
#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:(-!!(e)); }))
^
./include/linux/compiler.h:351:28: note: in expansion of macro 'BUILD_BUG_ON_ZERO'
#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
^
./include/linux/kernel.h:47:59: note: in expansion of macro '__must_be_array'
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
^
drivers/phy/renesas/phy-rcar-gen2.c:398:30: note: in expansion of macro 'ARRAY_SIZE'
if (error || channel_num > ARRAY_SIZE(data->select_value)) {
^
scripts/Makefile.build:278: recipe for target 'drivers/phy/renesas/phy-rcar-gen2.o' failed
regards,
Biju
next prev parent reply other threads:[~2019-05-16 12:32 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 [this message]
2019-05-16 12:34 ` Geert Uytterhoeven
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=OSBPR01MB21031BCDA0AEBD7A6EE6E9A9B80A0@OSBPR01MB2103.jpnprd01.prod.outlook.com \
--to=biju.das@bp.renesas.com \
--cc=Chris.Paterson2@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).