summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg
diff options
context:
space:
mode:
authorDandan Bi <dandan.bi@intel.com>2018-11-07 16:14:22 +0800
committerLiming Gao <liming.gao@intel.com>2018-11-21 13:01:02 +0800
commit63f151aadb0a96467cd73f8c648c223f13fe37ba (patch)
tree5b0e591757e6ae28491e351f7a956a63e6173dbc /MdeModulePkg
parent3cc9af5ce349466f55898929c60d80d741b6699d (diff)
downloadedk2-63f151aadb0a96467cd73f8c648c223f13fe37ba.tar.gz
edk2-63f151aadb0a96467cd73f8c648c223f13fe37ba.tar.bz2
edk2-63f151aadb0a96467cd73f8c648c223f13fe37ba.zip
MdeModulePkg/DisplayEngine: Remove useless NULL ptr check for NewPos
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>
Diffstat (limited to 'MdeModulePkg')
-rw-r--r--MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c b/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c
index 7390f954b6..44f087fe01 100644
--- a/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c
+++ b/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c
@@ -2882,6 +2882,7 @@ UiDisplayMenu (
//
ControlFlag = CfUpdateHelpString;
+ ASSERT (NewPos != NULL);
UpdateHighlightMenuInfo(NewPos, TopOfScreen, SkipValue);
if (SkipHighLight) {
@@ -2910,7 +2911,7 @@ UiDisplayMenu (
Temp2 = 0;
}
- if (NewPos != NULL && (MenuOption == NULL || NewPos != &MenuOption->Link)) {
+ if (MenuOption == NULL || NewPos != &MenuOption->Link) {
if (MenuOption != NULL) {
//
// Remove the old highlight menu.