From nobody Sun May 19 04:05:40 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+97913+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+97913+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1672811852; cv=none; d=zohomail.com; s=zohoarc; b=aSo7qpF/SIYHkf498ZvYXJx23gE0l3d0hrhaHHftsVl4mxziShC94I4Y+rfK+pm6SnI6Fa6liZiQmEkSCGqc/k/Z3QGl/rywwUMNF7eWL4y8FqxSWnWRSxqUkg+Lc+EFg7XDkrdlz6AK1mJwtUZF3/kkrLZEh+ilMZLvtpIrW2k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1672811852; h=Content-Type:Date:From:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=eLqlNBMh5DtvI5+ch2ko/TbK4hRkva++AlU/BNlRlkE=; b=dGXu0r6J8rn9C0i2Bquw4pth5nva+ILH8+R/8zeyr+wz1J0z+XWDt9cpnywV/jXuDzYnMxNafV5RrN87bfukwyKf6pBsOMp87Kjy9OlmX5ylWqpFmuKmLBzqRKZRH7g+1Dy2brD6N1zF4jlR90AM+ktRv6hG0LqUxNO5Q6f7tds= 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+97913+1787277+3901457@groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 167281185222560.39844161549297; Tue, 3 Jan 2023 21:57:32 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id 6HD2YY1788612xZbahXMpKrg; Tue, 03 Jan 2023 21:57:31 -0800 Subject: [edk2-devel] [PATCH] MdeModulePkg/Bus/Ata/AtaBusDxe: Fix SIGN_EXTENSION Coverity issue To: devel@edk2.groups.io From: "Ranbir Singh via groups.io" X-Originating-Location: Bengaluru, Karnataka, IN (122.172.85.38) X-Originating-Platform: Windows Chrome 108 User-Agent: GROUPS.IO Web Poster MIME-Version: 1.0 Date: Tue, 03 Jan 2023 21:57:31 -0800 Message-ID: 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,Ranbir.Singh3@Dell.com X-Gm-Message-State: zsSSJ0fjrF64dEh4qBzkt4ZMx1787277AA= Content-Type: multipart/alternative; boundary="SWAdvDO8pxKOZnHOu5j6" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1672811851; bh=v5MPnB9hfiwDEvrY0R0ybduDm8+OBzSogUrkWgsv9xI=; h=Content-Type:Date:From:Reply-To:Subject:To; b=SFFbPYDkhmWPyR6Ugo+CgofGV+Sl6SZZbNXTbcwQ4S90ABPr44+dQln08mSWkKn0Ong ecoo+sk9F/8S6/tXz+FWeAYfNrOdXZ9JRszyLhmgXnOzljIYxNLWZmq7xUFy4ONNHcRLN 5GsJc2xTEpWrrUHmZ8kdosZjcejmCO3BV6o= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1672811853001100001 --SWAdvDO8pxKOZnHOu5j6 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Line number 365 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=3D4209 Signed-off-by: Ranbir Singh --- MdeModulePkg/Bus/Ata/AtaBusDxe/AtaPassThruExecute.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MdeModulePkg/Bus/Ata/AtaBusDxe/AtaPassThruExecute.c b/MdeModul= ePkg/Bus/Ata/AtaBusDxe/AtaPassThruExecute.c index 4334169d25..081cd5595a 100644 --- a/MdeModulePkg/Bus/Ata/AtaBusDxe/AtaPassThruExecute.c +++ b/MdeModulePkg/Bus/Ata/AtaBusDxe/AtaPassThruExecute.c @@ -362,7 +362,7 @@ IdentifyAtaDevice ( // Check logical block size // if ((PhyLogicSectorSupport & BIT12) !=3D 0) { -=C2=A0 =C2=A0 =C2=A0 BlockMedia->BlockSize =3D (UINT32)(((IdentifyData->lo= gic_sector_size_hi << 16) | IdentifyData->logic_sector_size_lo) * sizeof (U= INT16)); +=C2=A0 =C2=A0 =C2=A0 BlockMedia->BlockSize =3D (((UINT32)(IdentifyData->lo= gic_sector_size_hi << 16) | IdentifyData->logic_sector_size_lo) * sizeof (U= INT16)); } AtaDevice->BlockIo.Revision =3D EFI_BLOCK_IO_PROTOCOL_REVISION2; -- 2.36.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 (#97913): https://edk2.groups.io/g/devel/message/97913 Mute This Topic: https://groups.io/mt/96045622/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- --SWAdvDO8pxKOZnHOu5j6 Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable
Line number 365 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=3D4209
Signed-off-by: Ranbir Singh <Ranbir.Singh3@Dell.com>
---
 MdeModulePkg/Bus/Ata/AtaBusDxe/AtaPassThruExecute.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
 
diff --git a/MdeModulePkg/Bus/Ata/AtaBusDxe/AtaPassThruExecute.c b/Mde= ModulePkg/Bus/Ata/AtaBusDxe/AtaPassThruExecute.c
index 4334169d25..081cd5595a 100644
--- a/MdeModulePkg/Bus/Ata/AtaBusDxe/AtaPassThruExecute.c
+++ b/MdeModulePkg/Bus/Ata/AtaBusDxe/AtaPassThruExecute.c
@@ -362,7 +362,7 @@ IdentifyAtaDevice (
     // Check logical block size
     //
     if ((PhyLogicSectorSupport & BIT12) !=3D 0) {<= /div>
-      BlockMedia->BlockSize =3D (UINT32)(((Identify= Data->logic_sector_size_hi << 16) | IdentifyData->logic_sector_= size_lo) * sizeof (UINT16));
+      BlockMedia->BlockSize =3D (((UINT32)(Identify= Data->logic_sector_size_hi << 16) | IdentifyData->logic_sector_= size_lo) * sizeof (UINT16));
     }
 
     AtaDevice->BlockIo.Revision =3D EFI_BLOCK_IO_PR= OTOCOL_REVISION2;
--
2.36.1.windows.1
_._,_._,_

Groups.io Links:

=20 You receive all messages sent to this group. =20 =20

= View/Reply Online (#97913) | =20 | Mute = This Topic | New Topic
Your Subscriptio= n | Contact Group Owner | Unsubscribe [importer@patchew.org]

_._,_._,_
--SWAdvDO8pxKOZnHOu5j6--