From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.151; helo=mga17.intel.com; envelope-from=star.zeng@intel.com; receiver=edk2-devel@lists.01.org Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 3CB3821A00AE6 for ; Wed, 7 Nov 2018 17:09:49 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Nov 2018 17:09:48 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,477,1534834800"; d="scan'208";a="89432707" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga006.jf.intel.com with ESMTP; 07 Nov 2018 17:09:48 -0800 Received: from fmsmsx156.amr.corp.intel.com (10.18.116.74) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 7 Nov 2018 17:09:47 -0800 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by fmsmsx156.amr.corp.intel.com (10.18.116.74) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 7 Nov 2018 17:09:47 -0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.84]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.161]) with mapi id 14.03.0415.000; Thu, 8 Nov 2018 09:09:45 +0800 From: "Zeng, Star" To: "Bi, Dandan" , "edk2-devel@lists.01.org" CC: "Gao, Liming" , "Dong, Eric" , "Wu, Hao A" , "Zeng, Star" Thread-Topic: [patch] MdeModulePkg/DisplayEngine: Remove useless NULL ptr check for NewPos Thread-Index: AQHUdqmi+9qdaaQRL0KGsRvkHjCPpaVFEg1A Date: Thu, 8 Nov 2018 01:09:44 +0000 Message-ID: <0C09AFA07DD0434D9E2A0C6AEB048310401EC2D7@shsmsx102.ccr.corp.intel.com> References: <20181107145311.42488-1-dandan.bi@intel.com> In-Reply-To: <20181107145311.42488-1-dandan.bi@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZjVjN2VlMGEtNDYzYS00MmY4LThkNjUtMGIxZDYyMjUxMmQ0IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiaG1DdmhmT1c3ZU84MHdLTE1qbk8xbU5zNHN6dWd1UHFEWG81cmVOV29STk04bFwvbVwvdHhWQ28rSDV2V1hkQjRDIn0= dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [patch] MdeModulePkg/DisplayEngine: Remove useless NULL ptr check for NewPos X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Nov 2018 01:09:49 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Star Zeng -----Original Message----- From: Bi, Dandan=20 Sent: Wednesday, November 7, 2018 10:53 PM To: edk2-devel@lists.01.org Cc: Gao, Liming ; Dong, Eric ; Z= eng, Star ; Wu, Hao A Subject: [patch] MdeModulePkg/DisplayEngine: Remove useless NULL ptr check = for NewPos REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1306 In function UiDisplayMenu, the NewPos ptr which used to point to the highli= ght menu entry. It will always point to the menu entry which need to be hig= hlighted 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 poin= ter dereference issue raised from static analysis. Cc: Liming Gao Cc: Eric Dong Cc: Star Zeng Cc: Hao Wu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Dandan Bi --- MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c b/MdeMod= ulePkg/Universal/DisplayEngineDxe/FormDisplay.c index 7390f954b6..44f087fe01 100644 --- a/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c +++ b/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c @@ -2880,10 +2880,11 @@ UiDisplayMenu ( // MenuOption is set to NULL in Repaint // NewPos: Current menu option that need to hilight // ControlFlag =3D CfUpdateHelpString; =20 + ASSERT (NewPos !=3D NULL); UpdateHighlightMenuInfo(NewPos, TopOfScreen, SkipValue); =20 if (SkipHighLight) { SkipHighLight =3D FALSE; MenuOption =3D SavedMenuOption; @@ -2908,11 +2909,11 @@ UiDisplayMenu ( Temp2 =3D SkipValue; } else { Temp2 =3D 0; } =20 - if (NewPos !=3D NULL && (MenuOption =3D=3D NULL || NewPos !=3D &Menu= Option->Link)) { + if (MenuOption =3D=3D NULL || NewPos !=3D &MenuOption->Link) { if (MenuOption !=3D NULL) { // // Remove the old highlight menu. // Status =3D DisplayOneMenu (MenuOption, -- 2.18.0.windows.1