]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/DisplayEngine: Remove useless NULL ptr check for NewPos
authorDandan Bi <dandan.bi@intel.com>
Wed, 7 Nov 2018 08:14:22 +0000 (16:14 +0800)
committerLiming Gao <liming.gao@intel.com>
Thu, 8 Nov 2018 05:40:08 +0000 (13:40 +0800)
In function UiDisplayMenu, the NewPos ptr which used to point to the
highlight menu entry. It will always point to the menu entry which
need to be highlighted or the gMenuOption menu if the highlight menu
is not found.
So we can remove the NULL ptr check for NewPos in this function.
And add the ASSERT code to avoid if any false positive reports
of NULL pointer dereference issue raised from static analysis.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Hao Wu <hao.a.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c

index 7390f954b67f1ec13d41b3dea404964096356563..44f087fe01aa4bf05d79745b8d949785b0a66753 100644 (file)
@@ -2882,6 +2882,7 @@ UiDisplayMenu (
       //\r
       ControlFlag = CfUpdateHelpString;\r
 \r
+      ASSERT (NewPos != NULL);\r
       UpdateHighlightMenuInfo(NewPos, TopOfScreen, SkipValue);\r
 \r
       if (SkipHighLight) {\r
@@ -2910,7 +2911,7 @@ UiDisplayMenu (
         Temp2 = 0;\r
       }\r
 \r
-      if (NewPos != NULL && (MenuOption == NULL || NewPos != &MenuOption->Link)) {\r
+      if (MenuOption == NULL || NewPos != &MenuOption->Link) {\r
         if (MenuOption != NULL) {\r
           //\r
           // Remove the old highlight menu.\r