From: David Laight <David.Laight@ACULAB.COM>
To: "'Bjorn Helgaas'" <bhelgaas@google.com>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH] phy: fix compiler array bounds warning on settings[]
Date: Wed, 5 Mar 2014 15:10:34 +0000 [thread overview]
Message-ID: <063D6719AE5E284EB5DD2968C1650D6D0F6D1D1E@AcuExch.aculab.com> (raw)
In-Reply-To: <CAErSpo5Pb2bABmnQZ04KRqjU=38=Pcr2OQv8hUJd_hv69QVc-A@mail.gmail.com>
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 1195 bytes --]
From: Bjorn Helgaas
> On Wed, Mar 5, 2014 at 2:10 AM, David Laight <David.Laight@aculab.com> wrote:
> > From: Bjorn Helgaas
> >> With -Werror=array-bounds, gcc v4.7.x warns that in phy_find_valid(), the
> >> settings[] "array subscript is above array bounds", I think because idx is
> >> a signed integer and if the caller supplied idx < 0, we pass the guard but
> >> still reference out of bounds.
> >
> > Not rejecting the patch but...
> >
> > Just indexing an array with 'int' shouldn't cause this warning,
> > so somewhere a caller must actually be passing an idx < 0.
> >
> > While changing the type to unsigned will make the comparison
> > against the array bound reject the -1, I suspect that the
> > specific call path didn't really intend passing a hard-coded -1.
> >
> > It might be worth trying to locate the call site that passes -1.
>
> I agree 100%. If that's the case, we definitely should find that
> caller rather than apply this patch. I'll look more today.
You might want to apply the patch as well :-)
David
ÿôèº{.nÇ+·®+%Ëÿ±éݶ\x17¥wÿº{.nÇ+·¥{±þG«éÿ{ayº\x1dÊÚë,j\a¢f£¢·hïêÿêçz_è®\x03(éÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?¨èÚ&£ø§~á¶iOæ¬z·vØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?I¥
next prev parent reply other threads:[~2014-03-05 15:11 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-05 0:35 Bjorn Helgaas
2014-03-05 0:43 ` Florian Fainelli
2014-03-05 9:10 ` David Laight
2014-03-05 14:54 ` Bjorn Helgaas
2014-03-05 15:10 ` David Laight [this message]
2014-03-05 20:54 ` Bjorn Helgaas
2014-03-06 9:13 ` David Laight
2014-03-06 21:07 ` David Miller
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=063D6719AE5E284EB5DD2968C1650D6D0F6D1D1E@AcuExch.aculab.com \
--to=david.laight@aculab.com \
--cc=bhelgaas@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@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
all inboxes | Powered by JetHome®