kernel: bump 5.4 to 5.4.109
[openwrt/openwrt.git] / target / linux / layerscape / patches-5.4 / 701-net-0106-sdk_fman-avoid-array-overflow-error-in-fman-port-ini.patch
1 From 5dc04d9dc9ac5d6eca6f1602a7b1c3b5a61625f4 Mon Sep 17 00:00:00 2001
2 From: Florinel Iordache <florinel.iordache@nxp.com>
3 Date: Mon, 4 Feb 2019 09:45:54 +0200
4 Subject: [PATCH] sdk_fman: avoid array overflow error in fman port init
5
6 Perform a verification of external buffer pools used which can cause array
7 overflow error in port init function SetExtBufferPools() if it was set to
8 value 1 via fman port API
9
10 Signed-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 */