From nobody Mon May 13 00:54:07 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+106989+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+106989+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1689670921; cv=none; d=zohomail.com; s=zohoarc; b=GuNNmJqVpk86vx9Y0oZbPDm2kP5vfR5EBbqZcO6xCQr2LUrpbxO3GwNOJwj5gGWgYSQCk1e9JiAP19yFzhU9NpzpwQzATO9r7STpdE4GioXMCMcWCsOtSnac/6ujEMnCO66IAw+encV6T94PgG9OlO0M6ghRsHKWZSRJnXgQFhA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689670921; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=+41QuNugQ3xDU8J+UDcQDG0ryIitdkDZ1uMJHaSFAFI=; b=ncCfVM+BwHpw18ILx1AfD+ef8EU4q8GOb0OJVJs9GboAk0v2CjuH/eRjYZFO7Gq1dufGS8PQyGCZfzlO2wkVhJxATCRszUwS6qGpooUbBbWmuXpYt/5kZW+930meHGZKYt+H8w4e6ZIrOWyvSGIzBmMbCBItHybhmPhjzL1xngA= 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+106989+1787277+3901457@groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 168967092188039.80950271305153; Tue, 18 Jul 2023 02:02:01 -0700 (PDT) Return-Path: DKIM-Signature: a=rsa-sha256; bh=AtEkwnxu7N2tNnFB9EJ16NmVvWl80CEKiAL2DjEcjPI=; c=relaxed/simple; d=groups.io; h=X-Received:X-Received:X-Received:X-Gm-Message-State:X-Google-Smtp-Source:X-Received:X-Received:From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Precedence:List-Unsubscribe:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:Content-Transfer-Encoding; s=20140610; t=1689670921; v=1; b=evV5wEqVJ4iMMYvp2NcWqwSQmQiHEnEAxeZcF0jwibCGQJX/uzB/EBu0/WBPVmV343obaqbx 7I/9Whdl00Q6MPdNpG+niQmVHZJvOSQUhCyVAUPmApXKrKuA9RaRi2xabHg1wcmHVG527fYxcxb xD66LU0S0da+Ih4w+2QIRJgw= X-Received: by 127.0.0.2 with SMTP id C2dxYY1788612xkr7QlZWOVl; Tue, 18 Jul 2023 02:02:01 -0700 X-Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173]) by mx.groups.io with SMTP id smtpd.web11.1428.1689567891425160619 for ; Sun, 16 Jul 2023 21:24:51 -0700 X-Received: by mail-pf1-f173.google.com with SMTP id d2e1a72fcca58-6726d5d92afso3097947b3a.1 for ; Sun, 16 Jul 2023 21:24:51 -0700 (PDT) X-Gm-Message-State: 7d2ghFf8FpiQUY8SefpzgTvIx1787277AA= X-Google-Smtp-Source: APBJJlG6/lWCIaD4j8Ltmc44rxUXnjZaIb8H7sroYqhGqSSwPnWiZtDJRFile4HzOD/m7uOuV37ORw== X-Received: by 2002:a05:6a20:3c87:b0:12c:76d1:bcec with SMTP id b7-20020a056a203c8700b0012c76d1bcecmr11599821pzj.20.1689567890779; Sun, 16 Jul 2023 21:24:50 -0700 (PDT) X-Received: from user-Latitude-5420.dc1.ventanamicro.com ([2401:4900:1cbd:8dd2:c2bf:93e0:5979:e5e0]) by smtp.gmail.com with ESMTPSA id f10-20020a63de0a000000b0055c090df2fasm11537914pgg.93.2023.07.16.21.24.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 16 Jul 2023 21:24:50 -0700 (PDT) From: Ranbir Singh To: devel@edk2.groups.io, rsingh@ventanamicro.com Cc: Hao A Wu , Ray Ni Subject: [edk2-devel] [PATCH v4 1/2] MdeModulePkg/Bus/Ata/AtaAtapiPassThru: Fix SIGN_EXTENSION Coverity issue Date: Mon, 17 Jul 2023 09:54:43 +0530 Message-Id: <20230717042444.2242552-2-rsingh@ventanamicro.com> In-Reply-To: <20230717042444.2242552-1-rsingh@ventanamicro.com> References: <20230717042444.2242552-1-rsingh@ventanamicro.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: 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,rsingh@ventanamicro.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1689670923787100009 Content-Type: text/plain; charset="utf-8" From: Ranbir Singh Line number 1348 does contain a typecast with UINT32, but it is after all the operations (16-bit left shift followed by OR'ing) are over. To avoid any SIGN_EXTENSION, typecast the intermediate result after 16-bit left shift operation immediately with UINT32. REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4204 Cc: Hao A Wu Cc: Ray Ni Signed-off-by: Ranbir Singh Signed-off-by: Ranbir Singh Reviewed-by: Hao A Wu --- MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.c b/Mde= ModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.c index 50406fe0270d..f39c909d0631 100644 --- a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.c +++ b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.c @@ -1345,7 +1345,7 @@ AtaPassThruPassThru ( // Check logical block size // if ((IdentifyData->AtaData.phy_logic_sector_support & BIT12) !=3D 0) { - BlockSize =3D (UINT32)(((IdentifyData->AtaData.logic_sector_size_hi = << 16) | IdentifyData->AtaData.logic_sector_size_lo) * sizeof (UINT16)); + BlockSize =3D (UINT32)(((UINT32)(IdentifyData->AtaData.logic_sector_= size_hi << 16) | IdentifyData->AtaData.logic_sector_size_lo) * sizeof (UINT= 16)); } } =20 --=20 2.34.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 (#106989): https://edk2.groups.io/g/devel/message/106989 Mute This Topic: https://groups.io/mt/100212104/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- From nobody Mon May 13 00:54:07 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+106990+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+106990+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1689670923; cv=none; d=zohomail.com; s=zohoarc; b=aWXn7cWuvxD7QrvGqZXJYC33q5UJ4Pr4eeDXk3OFyoc7J7ljha3BcyoZd/uUCscjHiwYAD8WDEf5fI0hwL00Bx+zKnQuykR5FwccW+lpl6Z0w9Y5WxUZEuh1f67s37pjueaFP6Uij0/h/AexkaBbx7SF3l1x26Q0vSq8Evd8BJA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689670923; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=tUM/qI4d2Fulo1KxnNEd70PJCMekl6gSP/GFGS3kOXI=; b=cO7FGQSoGQoDD+X9tLk5NIZrOu/vJa6oJI/cwy7oPH6GgxDv4ggX+Dcwg9l0BFvwr/wWAXH4btSqlYgDkbZM5yeoPkkb2hKW7aGX4nKnzA99kmYN0c1CaIvc2EwGjtpkp0uWJeEECrfsaHIaqVVsD+ZWxz+/q3hlrmmDHXnm/4I= 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+106990+1787277+3901457@groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1689670923081516.4321630045587; Tue, 18 Jul 2023 02:02:03 -0700 (PDT) Return-Path: DKIM-Signature: a=rsa-sha256; bh=j81NpM3zVOUWkSoB26BeqUP0eTVi9p9Yu8dDeM3plzQ=; c=relaxed/simple; d=groups.io; h=X-Received:X-Received:X-Received:X-Gm-Message-State:X-Google-Smtp-Source:X-Received:X-Received:From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Precedence:List-Unsubscribe:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:Content-Transfer-Encoding; s=20140610; t=1689670922; v=1; b=RkR1LauytwblgMfjOKMpcWBLvk7aD5DxUCvrIdlulk8sN2CxoRLPHjBi5mzL5IV4KBVT5fn/ usBsfk8OU2lIx4hZ0X8QrPQNmRGsXwVZtp48MPh/OoB7MbTN4cMeq4i3UkmQFusXehzVU7cKDfI 5uWsa5SjPA9nBbhoZQd58EoA= X-Received: by 127.0.0.2 with SMTP id 08kMYY1788612x3gTADcLWXr; Tue, 18 Jul 2023 02:02:02 -0700 X-Received: from mail-pf1-f178.google.com (mail-pf1-f178.google.com [209.85.210.178]) by mx.groups.io with SMTP id smtpd.web10.1426.1689567893708758020 for ; Sun, 16 Jul 2023 21:24:53 -0700 X-Received: by mail-pf1-f178.google.com with SMTP id d2e1a72fcca58-66c729f5618so4200386b3a.1 for ; Sun, 16 Jul 2023 21:24:53 -0700 (PDT) X-Gm-Message-State: qAbY4uKbJ66u34YN9Kv7XKkUx1787277AA= X-Google-Smtp-Source: APBJJlF/+GvFbH7zxZxhfWWPbpqMNqwVHNjMB7kcq70SacRnmoCDNK3c1Fw/LE9o+lK9FNzw+m5Z9A== X-Received: by 2002:a05:6a00:10c3:b0:67a:b045:e290 with SMTP id d3-20020a056a0010c300b0067ab045e290mr14312442pfu.4.1689567892898; Sun, 16 Jul 2023 21:24:52 -0700 (PDT) X-Received: from user-Latitude-5420.dc1.ventanamicro.com ([2401:4900:1cbd:8dd2:c2bf:93e0:5979:e5e0]) by smtp.gmail.com with ESMTPSA id f10-20020a63de0a000000b0055c090df2fasm11537914pgg.93.2023.07.16.21.24.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 16 Jul 2023 21:24:52 -0700 (PDT) From: Ranbir Singh To: devel@edk2.groups.io, rsingh@ventanamicro.com Cc: Hao A Wu , Ray Ni Subject: [edk2-devel] [PATCH v4 2/2] MdeModulePkg/Bus/Ata/AtaAtapiPassThru: Fix UNUSED_VALUE Coverity issue Date: Mon, 17 Jul 2023 09:54:44 +0530 Message-Id: <20230717042444.2242552-3-rsingh@ventanamicro.com> In-Reply-To: <20230717042444.2242552-1-rsingh@ventanamicro.com> References: <20230717042444.2242552-1-rsingh@ventanamicro.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: 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,rsingh@ventanamicro.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1689670996104100001 Content-Type: text/plain; charset="utf-8" From: Ranbir Singh The return value stored in Status after call to SetDriveParameters is not made of any use thereafter and hence it remains as UNUSED. Based on Hao's findings (https://edk2.groups.io/g/devel/message/106844), the successful execution of SetDriveParameters() is not mandatory for initializing IDE mode of a hard disk device. Hence remove the 'Status' assignment of the return value from SetDriveParameters() and instead add error checks & DEBUG_WARN level messages within SetDriveParameters() function after sending INIT_DRIVE_PARAM & SET_MULTIPLE_MODE ATA commands. REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4204 Cc: Hao A Wu Cc: Ray Ni Signed-off-by: Ranbir Singh Signed-off-by: Ranbir Singh Reviewed-by: Hao A Wu --- MdeModulePkg/Bus/Ata/AtaAtapiPassThru/IdeMode.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/IdeMode.c b/MdeModulePkg= /Bus/Ata/AtaAtapiPassThru/IdeMode.c index 75403886e44a..19d7b4930cb7 100644 --- a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/IdeMode.c +++ b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/IdeMode.c @@ -1992,6 +1992,10 @@ SetDriveParameters ( NULL ); =20 + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_WARN, "Init Drive Parameters Fail, Status =3D %r\n", Sta= tus)); + } + // // Send Set Multiple parameters // @@ -2008,6 +2012,10 @@ SetDriveParameters ( NULL ); =20 + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_WARN, "Set Multiple Mode Parameters Fail, Status =3D %r\= n", Status)); + } + return Status; } =20 @@ -2549,13 +2557,13 @@ DetectAndConfigIdeDevice ( // if (DeviceType =3D=3D EfiIdeHarddisk) { // - // Init driver parameters + // Init drive parameters // DriveParameters.Sector =3D (UINT8)((ATA5_IDENTIFY_DATA *)(&B= uffer.AtaData))->sectors_per_track; DriveParameters.Heads =3D (UINT8)(((ATA5_IDENTIFY_DATA *)(&= Buffer.AtaData))->heads - 1); DriveParameters.MultipleSector =3D (UINT8)((ATA5_IDENTIFY_DATA *)(&B= uffer.AtaData))->multi_sector_cmd_max_sct_cnt; =20 - Status =3D SetDriveParameters (Instance, IdeChannel, IdeDevice, &Dri= veParameters, NULL); + SetDriveParameters (Instance, IdeChannel, IdeDevice, &DriveParameter= s, NULL); } =20 // --=20 2.34.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 (#106990): https://edk2.groups.io/g/devel/message/106990 Mute This Topic: https://groups.io/mt/100212105/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-