From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.24; helo=mga09.intel.com; envelope-from=liming.gao@intel.com; receiver=edk2-devel@lists.01.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) (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 A53602118D950 for ; Wed, 7 Nov 2018 16:27:46 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Nov 2018 16:27:43 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,477,1534834800"; d="scan'208";a="98497372" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by orsmga003.jf.intel.com with ESMTP; 07 Nov 2018 16:27:45 -0800 Received: from FMSMSX110.amr.corp.intel.com (10.18.116.10) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 7 Nov 2018 16:27:45 -0800 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by fmsmsx110.amr.corp.intel.com (10.18.116.10) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 7 Nov 2018 16:27:44 -0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.117]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.199]) with mapi id 14.03.0415.000; Thu, 8 Nov 2018 08:27:42 +0800 From: "Gao, Liming" To: "Bi, Dandan" , "edk2-devel@lists.01.org" CC: "Dong, Eric" , "Zeng, Star" , "Wu, Hao A" Thread-Topic: [patch] MdeModulePkg/DisplayEngine: Remove useless NULL ptr check for NewPos Thread-Index: AQHUdqmiCNK2ekw/m0KKS894fU9KF6VFBlyg Date: Thu, 8 Nov 2018 00:27:42 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14E366260@SHSMSX104.ccr.corp.intel.com> References: <20181107145311.42488-1-dandan.bi@intel.com> In-Reply-To: <20181107145311.42488-1-dandan.bi@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMDIyOWE3ZGYtZWNjYi00OTkwLThkZmQtNWJjM2I0Y2NjY2RlIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiNzVzZzFXVml0RUZkY29nT2h3M1JJN2IxTEZWUGJhcDNYWFNENkhEbGVFbittRVVnM01hTHVTUXhOMzU3aVBCKyJ9 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 00:27:46 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Liming Gao > -----Original Message----- > From: Bi, Dandan > Sent: Wednesday, November 7, 2018 10:53 PM > To: edk2-devel@lists.01.org > Cc: Gao, Liming ; Dong, Eric ;= Zeng, Star ; Wu, Hao A > > Subject: [patch] MdeModulePkg/DisplayEngine: Remove useless NULL ptr chec= k for NewPos >=20 > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1306 >=20 > 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. >=20 > 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(-) >=20 > diff --git a/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c b/MdeM= odulePkg/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 &Me= nuOption->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