From nobody Mon May 6 10:30:44 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+67917+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+67917+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1606269275; cv=none; d=zohomail.com; s=zohoarc; b=PmvSM6POdwfd34fBqWNJy406ieIpEFTWbyiFcXcU0tzGJ4LhgKeWAoJqAI/UNWbeQukGFXud32F4Rd8en9rPEvX6Mx9/duxmSjNmAz+MDzlWE6omiGEq5H+vgCaMOhjEfHmkHY+lrIEeSzfILhNiDGZ6lywZnekLVuFhSJHCW18= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1606269275; h=Content-Type:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=en+0iow5bZ4d3xzvziKdjduwLbwod7X5vCnk4wBPP/Y=; b=Itv4gl5Y16phiE0yyz0Qzf94qdZKtAhj0tk8o+ru9XK5breu3+cL/LGreVlrOLn3xe6nfODGiPT7lJFbGw6SVN6wnafEb3/q401uyE1ZPeL17LZ65MaGx4pWo0Ipjj7pC/oMROFvU0JiiEXEXXV2FMY2h7ufyhTwB4HqekT0Kp8= 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+67917+1787277+3901457@groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1606269275388790.0941771763746; Tue, 24 Nov 2020 17:54:35 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id JnpCYY1788612xLu5K3Df3hs; Tue, 24 Nov 2020 17:54:34 -0800 X-Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) by mx.groups.io with SMTP id smtpd.web12.1110.1606269273197359947 for ; Tue, 24 Nov 2020 17:54:33 -0800 X-Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4CgkTG1cyTz15RlS for ; Wed, 25 Nov 2020 09:54:10 +0800 (CST) X-Received: from HGH1000039998.huawei.com (10.184.68.188) by DGGEMS404-HUB.china.huawei.com (10.3.19.204) with Microsoft SMTP Server id 14.3.487.0; Wed, 25 Nov 2020 09:54:22 +0800 From: "wenyi,xie via groups.io" To: , , , , CC: , Subject: [edk2-devel] [PATCH EDK2 v1 1/1] MdeModulePkg/FileExplorerLib: remove redundant null pointer check Date: Wed, 25 Nov 2020 09:52:51 +0800 Message-ID: <1606269171-21979-2-git-send-email-xiewenyi2@huawei.com> In-Reply-To: <1606269171-21979-1-git-send-email-xiewenyi2@huawei.com> References: <1606269171-21979-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: BhHffyA2iBrueQEQvky5noG5x1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1606269274; bh=B7ympJBGaERNt+BZHZMOK3P1qM5vW1s7uXwWiBy++/s=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=Xo9IvlKbfr6tx4B/xgbxJz6xQdLaxPuPy/n9RCVSGqj73y0hJONNMJnvlX3j2tsIpN1 srZwli4E+PNawruIPA4fao8jQyX7otrtiTstXKkWIU13k+iPjWLP+rPMxg83fdaURrAOn RK+Jlyg9kmMhIiiwAh7KGkoKD+6bPL8ZgBE= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Since Info is a pointer of struct EFI_FILE_SYSTEM_VOLUME_LABEL, and this struct has only one member VolumeLabel which is char array. So Info and Info->VolumeLabel are point to the same address, and if Info !=3D NULL, Info->VolumeLabel =3D=3D NULL is always false, it's no necessary to do null pointer check again. Cc: Jian J Wang Cc: Hao A Wu Cc: Dandan Bi Cc: Eric Dong Signed-off-by: Wenyi Xie --- 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 (#67917): https://edk2.groups.io/g/devel/message/67917 Mute This Topic: https://groups.io/mt/78491894/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-