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.136; helo=mga12.intel.com; envelope-from=hao.a.wu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) (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 E414D21BADAB6 for ; Tue, 16 Oct 2018 01:14:50 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Oct 2018 01:14:49 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,387,1534834800"; d="scan'208";a="272788292" Received: from shwdeopenpsi014.ccr.corp.intel.com ([10.239.9.9]) by fmsmga006.fm.intel.com with ESMTP; 16 Oct 2018 01:14:50 -0700 From: Hao Wu To: edk2-devel@lists.01.org Cc: Hao Wu , Ruiyu Ni Date: Tue, 16 Oct 2018 16:14:41 +0800 Message-Id: <20181016081442.24236-6-hao.a.wu@intel.com> X-Mailer: git-send-email 2.12.0.windows.1 In-Reply-To: <20181016081442.24236-1-hao.a.wu@intel.com> References: <20181016081442.24236-1-hao.a.wu@intel.com> Subject: [PATCH v2 5/6] MdeModulePkg/UdfDxe: Handle dead codes in File.c 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: Tue, 16 Oct 2018 08:14:51 -0000 REF:https://bugzilla.tianocore.org/show_bug.cgi?id=1249 We found potential dead codes within File.c during the code coverage test. After manual review, we think the below ones are positive reports: A. In function UdfRead(): else if (IS_FID_DELETED_FILE (Parent->FileIdentifierDesc)) { Status = EFI_DEVICE_ERROR; } A File Identifier Descriptor will be get from the UDF media only by function ReadDirectoryEntry(). And within this function, all the File Identifier Descriptor with 'DELETED_FILE' characteristics will be skipped and will not be returned. Hence, the above codes in function UdfRead() will never be hit. This commit will add "ASSERT (FALSE);" before the above line to indicate this. Cc: Ruiyu Ni Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Hao Wu Reviewed-by: Paulo Alcantara Reviewed-by: Star Zeng --- MdeModulePkg/Universal/Disk/UdfDxe/File.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/MdeModulePkg/Universal/Disk/UdfDxe/File.c b/MdeModulePkg/Universal/Disk/UdfDxe/File.c index 0730e6a3fa..eb7d79692b 100644 --- a/MdeModulePkg/Universal/Disk/UdfDxe/File.c +++ b/MdeModulePkg/Universal/Disk/UdfDxe/File.c @@ -500,6 +500,10 @@ UdfRead ( PrivFileData->FilePosition++; Status = EFI_SUCCESS; } else if (IS_FID_DELETED_FILE (Parent->FileIdentifierDesc)) { + // + // Code should never reach here. + // + ASSERT (FALSE); Status = EFI_DEVICE_ERROR; } -- 2.12.0.windows.1