openwrt/target/linux/layerscape/patches-5.4/701-net-0106-sdk_fman-avoid-array-overflow-error-in-fman-port-ini.patch

27 lines
1.2 KiB
Diff
Raw Normal View History

From 5dc04d9dc9ac5d6eca6f1602a7b1c3b5a61625f4 Mon Sep 17 00:00:00 2001
From: Florinel Iordache <florinel.iordache@nxp.com>
Date: Mon, 4 Feb 2019 09:45:54 +0200
Subject: [PATCH] sdk_fman: avoid array overflow error in fman port init
Perform a verification of external buffer pools used which can cause array
overflow error in port init function SetExtBufferPools() if it was set to
value 1 via fman port API
Signed-off-by: Florinel Iordache <florinel.iordache@nxp.com>
---
drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Port/fm_port.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Port/fm_port.c
+++ b/drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/Port/fm_port.c
@@ -581,7 +581,8 @@ static t_Error SetExtBufferPools(t_FmPor
p_FmPort->rxPoolsParams.numOfPools = p_ExtBufPools->numOfPoolsUsed;
p_FmPort->rxPoolsParams.largestBufSize =
sizesArray[orderedArray[p_ExtBufPools->numOfPoolsUsed - 1]];
- p_FmPort->rxPoolsParams.secondLargestBufSize =
+ if (p_ExtBufPools->numOfPoolsUsed > 1)
+ p_FmPort->rxPoolsParams.secondLargestBufSize =
sizesArray[orderedArray[p_ExtBufPools->numOfPoolsUsed - 2]];
/* FMBM_RMPD reg. - pool depletion */