[1/2] dt-bindings: phy: Update SERDES_MAX to be SERDES_MAX + 1

Message ID 3a1a95a4832af33dcd1842b0298d257bbcf1f5ab.1539036280.git.gustavo@embeddedor.com
State Not Applicable
Headers show
Series
  • [1/2] dt-bindings: phy: Update SERDES_MAX to be SERDES_MAX + 1
Related show

Commit Message

Gustavo A. R. Silva Oct. 8, 2018, 10:21 p.m.
SERDES_MAX is a valid value to index ctrl->phys in
drivers/phy/mscc/phy-ocelot-serdes.c. But, currently,
there is an out-of-bounds bug in the mentioned driver
when reading from ctrl->phys, because the size of
array ctrl->phys is SERDES_MAX.

Partially fix this by updating SERDES_MAX to be SERDES6G_MAX + 1.

Notice that this is the first part of the solution to
the out-of-bounds bug mentioned above. Although this
change is not dependent on any other one.

Suggested-by: Quentin Schulz <quentin.schulz@bootlin.com>
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
 include/dt-bindings/phy/phy-ocelot-serdes.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Quentin Schulz Oct. 9, 2018, 7:27 a.m. | #1
Hi Gustavo,

On Tue, Oct 09, 2018 at 12:21:36AM +0200, Gustavo A. R. Silva wrote:
> SERDES_MAX is a valid value to index ctrl->phys in
> drivers/phy/mscc/phy-ocelot-serdes.c. But, currently,
> there is an out-of-bounds bug in the mentioned driver
> when reading from ctrl->phys, because the size of
> array ctrl->phys is SERDES_MAX.
> 
> Partially fix this by updating SERDES_MAX to be SERDES6G_MAX + 1.
> 
> Notice that this is the first part of the solution to
> the out-of-bounds bug mentioned above. Although this
> change is not dependent on any other one.
> 

Reviewed-by: Quentin Schulz <quentin.schulz@bootlin.com>

Thanks,
Quentin
Gustavo A. R. Silva Oct. 16, 2018, 8:44 a.m. | #2
Hi,

On 10/9/18 9:27 AM, Quentin Schulz wrote:
> Hi Gustavo,
> 
> On Tue, Oct 09, 2018 at 12:21:36AM +0200, Gustavo A. R. Silva wrote:
>> SERDES_MAX is a valid value to index ctrl->phys in
>> drivers/phy/mscc/phy-ocelot-serdes.c. But, currently,
>> there is an out-of-bounds bug in the mentioned driver
>> when reading from ctrl->phys, because the size of
>> array ctrl->phys is SERDES_MAX.
>>
>> Partially fix this by updating SERDES_MAX to be SERDES6G_MAX + 1.
>>
>> Notice that this is the first part of the solution to
>> the out-of-bounds bug mentioned above. Although this
>> change is not dependent on any other one.
>>
> 
> Reviewed-by: Quentin Schulz <quentin.schulz@bootlin.com>
> 

Friendly ping. Who can you take this?

Thanks!
--
Gustavo
Rob Herring Oct. 17, 2018, 3:09 p.m. | #3
On Tue, Oct 16, 2018 at 10:44:52AM +0200, Gustavo A. R. Silva wrote:
> Hi,
> 
> On 10/9/18 9:27 AM, Quentin Schulz wrote:
> > Hi Gustavo,
> > 
> > On Tue, Oct 09, 2018 at 12:21:36AM +0200, Gustavo A. R. Silva wrote:
> >> SERDES_MAX is a valid value to index ctrl->phys in
> >> drivers/phy/mscc/phy-ocelot-serdes.c. But, currently,
> >> there is an out-of-bounds bug in the mentioned driver
> >> when reading from ctrl->phys, because the size of
> >> array ctrl->phys is SERDES_MAX.
> >>
> >> Partially fix this by updating SERDES_MAX to be SERDES6G_MAX + 1.
> >>
> >> Notice that this is the first part of the solution to
> >> the out-of-bounds bug mentioned above. Although this
> >> change is not dependent on any other one.
> >>
> > 
> > Reviewed-by: Quentin Schulz <quentin.schulz@bootlin.com>
> > 
> 
> Friendly ping. Who can you take this?

Applied. No need (nor benefit) to ping me. You can check the status of 
DT patches on patchwork[1]. If it is there and in the "New" state, it is 
in my queue.

Rob

[1] https://patchwork.ozlabs.org/project/devicetree-bindings/list/
Gustavo A. R. Silva Oct. 17, 2018, 3:19 p.m. | #4
On 10/17/18 5:09 PM, Rob Herring wrote:

>>
>> Friendly ping. Who can you take this?
> 
> Applied. No need (nor benefit) to ping me. You can check the status of 
> DT patches on patchwork[1]. If it is there and in the "New" state, it is 
> in my queue.
> 

OK. I've got it. I just didn't know who usually takes these dt-bindings patches.

> Rob
> 
> [1] https://patchwork.ozlabs.org/project/devicetree-bindings/list/
> 

Thanks, Rob.
--
Gustavo
Rob Herring Oct. 17, 2018, 3:23 p.m. | #5
On Wed, Oct 17, 2018 at 10:09:31AM -0500, Rob Herring wrote:
> On Tue, Oct 16, 2018 at 10:44:52AM +0200, Gustavo A. R. Silva wrote:
> > Hi,
> > 
> > On 10/9/18 9:27 AM, Quentin Schulz wrote:
> > > Hi Gustavo,
> > > 
> > > On Tue, Oct 09, 2018 at 12:21:36AM +0200, Gustavo A. R. Silva wrote:
> > >> SERDES_MAX is a valid value to index ctrl->phys in
> > >> drivers/phy/mscc/phy-ocelot-serdes.c. But, currently,
> > >> there is an out-of-bounds bug in the mentioned driver
> > >> when reading from ctrl->phys, because the size of
> > >> array ctrl->phys is SERDES_MAX.
> > >>
> > >> Partially fix this by updating SERDES_MAX to be SERDES6G_MAX + 1.
> > >>
> > >> Notice that this is the first part of the solution to
> > >> the out-of-bounds bug mentioned above. Although this
> > >> change is not dependent on any other one.
> > >>
> > > 
> > > Reviewed-by: Quentin Schulz <quentin.schulz@bootlin.com>
> > > 
> > 
> > Friendly ping. Who can you take this?
> 
> Applied. No need (nor benefit) to ping me. You can check the status of 
> DT patches on patchwork[1]. If it is there and in the "New" state, it is 
> in my queue.

Actually, this doesn't apply to my tree as the file doesn't exist. It 
needs to go thru the phy tree. You didn't Cc the maintainer nor list, so 
resend.

Acked-by: Rob Herring <robh@kernel.org>

Rob
Gustavo A. R. Silva Oct. 17, 2018, 3:45 p.m. | #6
On 10/17/18 5:23 PM, Rob Herring wrote:

>>> Friendly ping. Who can you take this?
>>
>> Applied. No need (nor benefit) to ping me. You can check the status of 
>> DT patches on patchwork[1]. If it is there and in the "New" state, it is 
>> in my queue.
> 
> Actually, this doesn't apply to my tree as the file doesn't exist. It 
> needs to go thru the phy tree. You didn't Cc the maintainer nor list, so 
> resend.
> 

This is what I get when I run the get_maintainer script:

linux$ scripts/get_maintainer.pl --nokeywords --nogit --nogit-fallback include/dt-bindings/phy/phy-ocelot-serdes.h
Rob Herring <robh+dt@kernel.org> (maintainer:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS)
Mark Rutland <mark.rutland@arm.com> (maintainer:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS)
devicetree@vger.kernel.org (open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS)
linux-kernel@vger.kernel.org (open list)

But I'll send it to the phy guys as you suggest.

> Acked-by: Rob Herring <robh@kernel.org>
> 

Thanks
--
Gustavo

Patch

diff --git a/include/dt-bindings/phy/phy-ocelot-serdes.h b/include/dt-bindings/phy/phy-ocelot-serdes.h
index bd28f21..fe70ada 100644
--- a/include/dt-bindings/phy/phy-ocelot-serdes.h
+++ b/include/dt-bindings/phy/phy-ocelot-serdes.h
@@ -7,6 +7,6 @@ 
 #define SERDES1G_MAX	SERDES1G(5)
 #define SERDES6G(x)	(SERDES1G_MAX + 1 + (x))
 #define SERDES6G_MAX	SERDES6G(2)
-#define SERDES_MAX	SERDES6G_MAX
+#define SERDES_MAX	(SERDES6G_MAX + 1)
 
 #endif