From 1ba231ff7637e520b4eeab9aacdd689d9f898628 Mon Sep 17 00:00:00 2001 From: astolfo Date: Thu, 12 May 2022 13:02:17 -0600 Subject: [PATCH] moved array sanity check to before the array access --- src/common/displayport/src/dp_configcaps.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/displayport/src/dp_configcaps.cpp b/src/common/displayport/src/dp_configcaps.cpp index a3e583e10..8ec82b277 100644 --- a/src/common/displayport/src/dp_configcaps.cpp +++ b/src/common/displayport/src/dp_configcaps.cpp @@ -402,7 +402,7 @@ struct DPCDHALImpl : DPCDHAL if (caps.linkRateTable[0] != 0) { bIndexedLinkrateCapable = true; - for (int i = 0; caps.linkRateTable[i] && (i < NV_DPCD_SUPPORTED_LINK_RATES__SIZE); i++) + for (int i = 0; (i < NV_DPCD_SUPPORTED_LINK_RATES__SIZE) && caps.linkRateTable[i]; i++) { if (linkRate < caps.linkRateTable[i]) linkRate = caps.linkRateTable[i];