2018-10-26 22:47:57

by Aaro Koskinen

[permalink] [raw]
Subject: [PATCH] MIPS: OCTEON: fix out of bounds array access on CN68XX

The maximum number of interfaces is returned by
cvmx_helper_get_number_of_interfaces(), and the value is used to access
interface_port_count[]. When CN68XX support was added, we forgot
to increase the array size. Fix that.

Fixes: 2c8c3f0201333 ("MIPS: Octeon: Support additional interfaces on CN68XX")
Signed-off-by: Aaro Koskinen <[email protected]>
---
arch/mips/cavium-octeon/executive/cvmx-helper.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/mips/cavium-octeon/executive/cvmx-helper.c b/arch/mips/cavium-octeon/executive/cvmx-helper.c
index 75108ec669eb..6c79e8a16a26 100644
--- a/arch/mips/cavium-octeon/executive/cvmx-helper.c
+++ b/arch/mips/cavium-octeon/executive/cvmx-helper.c
@@ -67,7 +67,7 @@ void (*cvmx_override_pko_queue_priority) (int pko_port,
void (*cvmx_override_ipd_port_setup) (int ipd_port);

/* Port count per interface */
-static int interface_port_count[5];
+static int interface_port_count[9];

/**
* Return the number of interfaces the chip has. Each interface
--
2.17.0



2018-11-05 18:08:26

by Paul Burton

[permalink] [raw]
Subject: Re: [PATCH] MIPS: OCTEON: fix out of bounds array access on CN68XX

Hi Aaro,

On Sat, Oct 27, 2018 at 01:46:34AM +0300, Aaro Koskinen wrote:
> The maximum number of interfaces is returned by
> cvmx_helper_get_number_of_interfaces(), and the value is used to access
> interface_port_count[]. When CN68XX support was added, we forgot
> to increase the array size. Fix that.
>
> Fixes: 2c8c3f0201333 ("MIPS: Octeon: Support additional interfaces on CN68XX")
> Signed-off-by: Aaro Koskinen <[email protected]>
> ---
> arch/mips/cavium-octeon/executive/cvmx-helper.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)

Thanks - applied to mips-fixes.

Paul