From nobody Sun May 12 15:17:37 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+105981+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+105981+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1686328587; cv=none; d=zohomail.com; s=zohoarc; b=CI5HjzwPTaegYaXt36n00oafccgqC8ZtdrztRjkF5CFxR54wpaKRRrplVSNnZsISNhUK36EB6D/DL2XB/P8gf40UkB+43nPruJkv9/xGv+tNyTua+3MBwWaWrriyTENPjn7JLrjdjhmROByrtuK+X9pxdK5EPK7A+ULeFOxLUlU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686328587; 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=zO2tNvqFWa4X02wlOu+FBKmleO2OILXUUJ8EDLpwLy8=; b=D7XUY28Q9dg7S9p+ozvzHSwxqX7xGOtzKk7e3LrLcFjzg7HpNliHEps8L6xT1uCD0GflIHZGmEsH4wFTrlfUOx+tXmtUMktV+eP7852WGpx21aCHEocmE29kprzDPPT9inTe3Fqx/xBvTanyfmUHanb7kXuxBhOiKfv2yI29+fg= 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+105981+1787277+3901457@groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1686328587313427.0733019007847; Fri, 9 Jun 2023 09:36:27 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id Mzg2YY1788612xOW4kcIsv1K; Fri, 09 Jun 2023 09:36:27 -0700 X-Received: from mail-ot1-f67.google.com (mail-ot1-f67.google.com [209.85.210.67]) by mx.groups.io with SMTP id smtpd.web11.12029.1686314012410517782 for ; Fri, 09 Jun 2023 05:33:32 -0700 X-Received: by mail-ot1-f67.google.com with SMTP id 46e09a7af769-6b2a4655352so595543a34.3 for ; Fri, 09 Jun 2023 05:33:32 -0700 (PDT) X-Gm-Message-State: j1DCcW5r0Ul5yVpXzdcdqya4x1787277AA= X-Google-Smtp-Source: ACHHUZ4MVYvk/4sI6QwSIuPHZnGkIKeTBTXMesbB0y/Nb84na0BCwwqLvUmFBzhl1V8qDs6ZwyunVg== X-Received: by 2002:a05:6871:503:b0:1a2:8ebd:7d46 with SMTP id s3-20020a056871050300b001a28ebd7d46mr1070773oal.21.1686314011566; Fri, 09 Jun 2023 05:33:31 -0700 (PDT) X-Received: from user-Latitude-5420.dc1.ventanamicro.com ([2401:4900:1f24:5b04:3850:5513:420:9d99]) by smtp.gmail.com with ESMTPSA id w1-20020a056870430100b00187e500e7b3sm2033013oah.49.2023.06.09.05.33.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Jun 2023 05:33:31 -0700 (PDT) From: Ranbir Singh To: devel@edk2.groups.io, rsingh@ventanamicro.com Cc: Hao A Wu , Ray Ni Subject: [edk2-devel] [PATCH v2 1/2] MdeModulePkg/Bus/Ata/AtaAtapiPassThru: Fix SIGN_EXTENSION Coverity issue Date: Fri, 9 Jun 2023 18:03:21 +0530 Message-Id: <20230609123322.191390-2-rsingh@ventanamicro.com> In-Reply-To: <20230609123322.191390-1-rsingh@ventanamicro.com> References: <20230609123322.191390-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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1686328587; bh=zVwQscahf8H6H8fsShtJ/6QMjNgtpfyevdEoY2zqhdQ=; h=Cc:Date:From:Reply-To:Subject:To; b=WEroK0XUcI8FAaPW0GfrTeDgbhtJkZGB2MqwoWplhnRdESti3hz1QXX204IQ/Hx39W2 Dud7vFhOEtSrYqqxif5ybFJBbJWr+Wwv3n0n5uhZl1M3lQlUT+lcl1khpsytRO3NaOGEd nhFq60Bumo7/K9eCWNaXFe8O2v5WL6+xedE= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1686328588098100003 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. Cc: Hao A Wu Cc: Ray Ni REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4204 Signed-off-by: Ranbir Singh Signed-off-by: Ranbir Singh Reviewed-by: Hao A Wu --- Notes: Retain outer cast 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 (#105981): https://edk2.groups.io/g/devel/message/105981 Mute This Topic: https://groups.io/mt/99432079/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 Sun May 12 15:17:37 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+105982+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+105982+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1686328587; cv=none; d=zohomail.com; s=zohoarc; b=EZMq4EahA0oaDIVrbuvfjGPd+bp0UKx7LYpyw3OExQKMB+gTlhTN0R2wNLCggmGLfojpcjQTKei7UlqXxmqRSJM7Wj3f9a22+6mSvV7BWWscJrQ1Bo3UMmhGecnyWq9mesL7bhwfxBPZWp+pSHpwPxurUV7Epdsv15VeYRuatxw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686328587; 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=0uhpYlBWp+kKTg/TZyWu4Xoxr8pFhgk2rlRZJ3JqCRs=; b=RE4XtIZTuR4kspOAYo2w0VI1rWvkFQtTB/4XwQKjWPFGwOyLwkgl2mqfdYvIlVgvBIBkl4Eb2a88dxFn9qSEoxnPgqYKQ6z4E3EahYuMVFzjP+oPKKx90Pf79WLKBbGdG5n9EM/+7NiES4qe9Vq+r0Q2TPnicTee+9zQqteX39A= 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+105982+1787277+3901457@groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1686328587709935.0768602379942; Fri, 9 Jun 2023 09:36:27 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id Wnz5YY1788612x65iMYd0NeJ; Fri, 09 Jun 2023 09:36:27 -0700 X-Received: from mail-oa1-f66.google.com (mail-oa1-f66.google.com [209.85.160.66]) by mx.groups.io with SMTP id smtpd.web10.12048.1686314015300828041 for ; Fri, 09 Jun 2023 05:33:35 -0700 X-Received: by mail-oa1-f66.google.com with SMTP id 586e51a60fabf-1a196784a4cso507985fac.1 for ; Fri, 09 Jun 2023 05:33:35 -0700 (PDT) X-Gm-Message-State: dzfOMK3aKDORaD0zJckUqqjnx1787277AA= X-Google-Smtp-Source: ACHHUZ7h7KiAgIt70/DLAlRzseazFEKHPNagWgUi0q4f9Jz/BHshmBHyICwk/LlzKrROH1EU48LQBg== X-Received: by 2002:a05:6870:1986:b0:199:d0fa:edec with SMTP id v6-20020a056870198600b00199d0faedecmr750360oam.4.1686314014268; Fri, 09 Jun 2023 05:33:34 -0700 (PDT) X-Received: from user-Latitude-5420.dc1.ventanamicro.com ([2401:4900:1f24:5b04:3850:5513:420:9d99]) by smtp.gmail.com with ESMTPSA id w1-20020a056870430100b00187e500e7b3sm2033013oah.49.2023.06.09.05.33.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Jun 2023 05:33:33 -0700 (PDT) From: Ranbir Singh To: devel@edk2.groups.io, rsingh@ventanamicro.com Cc: Hao A Wu , Ray Ni Subject: [edk2-devel] [PATCH v2 2/2] MdeModulePkg/Bus/Ata/AtaAtapiPassThru: Fix UNUSED_VALUE Coverity issue Date: Fri, 9 Jun 2023 18:03:22 +0530 Message-Id: <20230609123322.191390-3-rsingh@ventanamicro.com> In-Reply-To: <20230609123322.191390-1-rsingh@ventanamicro.com> References: <20230609123322.191390-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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1686328587; bh=l89vzAlDUvRNGo7ez+ecKikae03EtY/vvh/TApzdX0s=; h=Cc:Date:From:Reply-To:Subject:To; b=Y8qgEFN6HaQa9OE3ZF8+sMV4MEXaIep7b006q1uPHJpcuvBIOfVRRu4tbckEg+aF+Vc ppQmOccVhfLc2Gt6rxuoiV9UU8NrXUbQT5RJFcG6Piw9kvJeN5m4GIFI7pECM49NN2QdE FrWwD+gcRMLew12hPhqZFD3JrpKAhteiG2E= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1686328589545100011 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. Add error check as is done after calls to SetDeviceTransferMode. Cc: Hao A Wu Cc: Ray Ni REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4204 Signed-off-by: Ranbir Singh Signed-off-by: Ranbir Singh --- Notes: Add error check instead of Status storage removal MdeModulePkg/Bus/Ata/AtaAtapiPassThru/IdeMode.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/IdeMode.c b/MdeModulePkg= /Bus/Ata/AtaAtapiPassThru/IdeMode.c index 75403886e44a..d04b1d95a7f5 100644 --- a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/IdeMode.c +++ b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/IdeMode.c @@ -2549,13 +2549,18 @@ 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); + + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "Set Drive Parameters Fail, Status =3D %r\n",= Status)); + continue; + } } =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 (#105982): https://edk2.groups.io/g/devel/message/105982 Mute This Topic: https://groups.io/mt/99432080/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-