[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <063D6719AE5E284EB5DD2968C1650D6D0F6D1440@AcuExch.aculab.com>
Date: Wed, 5 Mar 2014 09:10:52 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Bjorn Helgaas' <bhelgaas@...gle.com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>
CC: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] phy: fix compiler array bounds warning on settings[]
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.
David
Powered by blists - more mailing lists