From 2fac2aa4a75794bdaa4bad5b968234ee4f99fa5d Mon Sep 17 00:00:00 2001 From: v-jaschen <144990999+v-jaschen@users.noreply.github.com> Date: Fri, 15 Nov 2024 04:54:38 +0800 Subject: [PATCH] =?UTF-8?q?MinPlatformPkg=20SerialPortTerminalLib:=20Fixin?= =?UTF-8?q?g=20CodeQL=20issue=20Pointless=20c=E2=80=A6=20(#311)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Description Cherry-pick Commit 03664aa #282 from release/202311 to dev/202405. CodeQL is reporting Pointless comparison of unsigned value to zero for a value derived from an unsigned PCD PcdDefaultTerminalType. For details on how to complete these options and their meaning refer to [CONTRIBUTING.md](https://github.com/microsoft/mu/blob/HEAD/CONTRIBUTING.md). - [ ] Impacts functionality? - [ ] Impacts security? - [ ] Breaking change? - [ ] Includes tests? - [ ] Includes documentation? - [X] Backport to release branch? ## How This Was Tested Ran Local CI including codeQL setting and pipeline codeQL build. ## Integration Instructions N/A ## upstream repo in EDK2? https://github.com/tianocore/edk2-platforms/pull/246 Co-authored-by: Aaron <105021049+apop5@users.noreply.github.com> Co-authored-by: Aaron --- .../Library/SerialPortTerminalLib/SerialPortTerminalLib.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/MinPlatformPkg/Library/SerialPortTerminalLib/SerialPortTerminalLib.c b/MinPlatformPkg/Library/SerialPortTerminalLib/SerialPortTerminalLib.c index eb127d8315..7d50e3168f 100644 --- a/MinPlatformPkg/Library/SerialPortTerminalLib/SerialPortTerminalLib.c +++ b/MinPlatformPkg/Library/SerialPortTerminalLib/SerialPortTerminalLib.c @@ -88,8 +88,7 @@ AddSerialTerminal ( (int) mSerialDevicePath.Uart.StopBits, (int) DefaultTerminalType)); - if (DefaultTerminalType >= 0 && - DefaultTerminalType < (sizeof (mTerminalType) / sizeof (mTerminalType[0]))) { + if (DefaultTerminalType < (sizeof (mTerminalType) / sizeof (mTerminalType[0]))) { CopyMem ( (VOID *) &(mSerialDevicePath.TerminalType.Guid), (VOID *) mTerminalType[DefaultTerminalType],