From nobody Wed May 1 16:52:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+68013+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+68013+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1606355544; cv=none; d=zohomail.com; s=zohoarc; b=BSg07/palvwuIt2BejIi0osoUGyk7ZjPYnFLSuDoMdmgJD+6IpMYLyI0LKGR+YQGp1Z+XEummXritU3vA78BHpfsizizZBZ2U5CB73ZUo+JTNJb0mKZJmTdIVZebrrtqc2vN8HsuDO4uNCvLestE/A37VSdmOQmF43urtv9FLSU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1606355544; h=Content-Type:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=m9YdBNwgCw4fMPk+P1gpxPM6VdvnZZdM7iXuSOQmlS4=; b=UXhEw2POwYuOAGNoHYAS/iw1ghc2Xa9Doc8cZeHiNjEBhpFbK8WQyyVpeeXOcm8Zg1yoN071UtvIcS9nXTXvxkFnmlDM4STCe7pZaTeH82StHABMrVLdtDx/ngkqh3hjoJXqSBVM/Al0C6RLmw9b7q8JHXgIUZL58UToSpz48tQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+68013+1787277+3901457@groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1606355544206564.2701569595495; Wed, 25 Nov 2020 17:52:24 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id YI9KYY1788612xoEixdNlDdI; Wed, 25 Nov 2020 17:52:23 -0800 X-Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) by mx.groups.io with SMTP id smtpd.web11.5966.1606355537142237501 for ; Wed, 25 Nov 2020 17:52:17 -0800 X-Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4ChLN61my5zhgf6; Thu, 26 Nov 2020 09:51:50 +0800 (CST) X-Received: from HGH1000039998.huawei.com (10.184.68.188) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.487.0; Thu, 26 Nov 2020 09:52:04 +0800 From: "wenyi,xie via groups.io" To: , , , , , CC: , Subject: [edk2-devel] [PATCH EDK2 v2 1/1] MdeModulePkg/FileExplorerLib: remove redundant null pointer check Date: Thu, 26 Nov 2020 09:50:33 +0800 Message-ID: <1606355433-2419-2-git-send-email-xiewenyi2@huawei.com> In-Reply-To: <1606355433-2419-1-git-send-email-xiewenyi2@huawei.com> References: <1606355433-2419-1-git-send-email-xiewenyi2@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.184.68.188] X-CFilter-Loop: Reflected Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,xiewenyi2@huawei.com X-Gm-Message-State: Of2HbViBzxuHmn68cc7JwzcLx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1606355543; bh=sbU+INdh8tGKe8MGmvUH3EvpwtbcRoqLoCW7Lb9lyjc=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=hc4g4KQGVkYkYkmyLrAFrh9CfAkvWiTUonemAPJaW8s27QfflRBvwls8VW+gCp4VEFP a4TAVjg3SzrArX7Zv4IPLvnMl0lhTefx58mxWM27Lv/nEfOoAz4HrkKfJL1WeiqDt9z1r Uiue1b/9f9d8nl3M1oXy4eHQr4hbI+5Hu9A= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" If "Info" is a valid pointer to an EFI_FILE_SYSTEM_VOLUME_LABEL structure, then "Info->VolumeLabel" denotes a valid array object. When the "Info->VolumeLabel" expression is evaluated, as seen in the LibFindFileSystem(), it is implicitly converted to (&Info->VolumeLabel[0]). Because the object described by the expression (Info->VolumeLabel[0]) is a valid CHAR16 object, its address can never compare equal to NULL. Therefore, the condition (Info->VolumeLabel =3D=3D NULL) will always evaluate to FALSE. Substitute the constant FALSE into the "if" statement, and simplify the resultant code (eliminate the dead branch). Cc: Jian J Wang Cc: Hao A Wu Cc: Dandan Bi Cc: Eric Dong Signed-off-by: Wenyi Xie Reviewed-by: Liming Gao Reviewed-by: Laszlo Ersek --- MdeModulePkg/Library/FileExplorerLib/FileExplorer.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/MdeModulePkg/Library/FileExplorerLib/FileExplorer.c b/MdeModul= ePkg/Library/FileExplorerLib/FileExplorer.c index 58e49102593c..13a214b06af9 100644 --- a/MdeModulePkg/Library/FileExplorerLib/FileExplorer.c +++ b/MdeModulePkg/Library/FileExplorerLib/FileExplorer.c @@ -821,13 +821,9 @@ LibFindFileSystem ( if (Info =3D=3D NULL) { VolumeLabel =3D L"NO FILE SYSTEM INFO"; } else { - if (Info->VolumeLabel =3D=3D NULL) { - VolumeLabel =3D L"NULL VOLUME LABEL"; - } else { - VolumeLabel =3D Info->VolumeLabel; - if (*VolumeLabel =3D=3D 0x0000) { - VolumeLabel =3D L"NO VOLUME LABEL"; - } + VolumeLabel =3D Info->VolumeLabel; + if (*VolumeLabel =3D=3D 0x0000) { + VolumeLabel =3D L"NO VOLUME LABEL"; } } MenuEntry->DisplayString =3D AllocateZeroPool (MAX_CHAR); --=20 2.20.1.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#68013): https://edk2.groups.io/g/devel/message/68013 Mute This Topic: https://groups.io/mt/78514206/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-