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