From nobody Sat May 18 23:55:31 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+97912+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+97912+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1672811715; cv=none; d=zohomail.com; s=zohoarc; b=NGHbp4s7XGhWBYzFJEGnq45su9RWlMS8Ks6695S8+1hrdUhO12r0KpxQXTCW8QdZXo8KG6RYi3vaycL0PQ44XMXR1nN/x1d0xtszA6RFBVDzGNJPyIv6mLp7x2SaZsBYxGU1CyIjuXMd9KWzYxCpY35BfafP0ViVEdjwdkviaVQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1672811715; h=Content-Type:Date:From:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=1WzTBYd+o84foBzZgQCL2EPh/7sRdxIsT6LaQQ1nV28=; b=SQjDxflhvA/BsrzObQ1pEJdBfVnlqetDLzwnk939Yp7UF6StWlNhd+auO3PeQffK5XhuutA+aXPNZoiU214RzsKclygPMdyynHgyMQPTa+/RwxAmPDZp8TrqURNSFDVdnbEpT6PHXoOoHiU2iRATPqV5zsyxWunBPyXrz6UBjbM= 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+97912+1787277+3901457@groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1672811715662366.82575277268995; Tue, 3 Jan 2023 21:55:15 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id WxG0YY1788612xEpRbj3ngXc; Tue, 03 Jan 2023 21:55:15 -0800 Subject: [edk2-devel] [PATCH] MdeModulePkg/Bus/Ata/AtaAtapiPassThru: 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:55:14 -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: NfRXs0awb1Ciin5E5w34IVUox1787277AA= Content-Type: multipart/alternative; boundary="gOEmlOfrLzIcjANl3Rof" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1672811715; bh=FCjtNh9PNOZlS0deQYMdi0QgDdbc5hoSgy6RkC+WB5I=; h=Content-Type:Date:From:Reply-To:Subject:To; b=MWio2dzazSDA7JMFLDz7XyugoS9LEYjnd1Yd63S/a3Ic78e61PPtpvoHOkmk7QjlsHh VRREg9zd/9GW9M8QY460IgKtQuHC0feI/sTuEXTDhL+WEXWT49fvFIyfobXD5NYh1MuIO AO1EGvRkPI4IdPEVLSP99+nffMXIKjsRvXQ= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1672811716311100001 --gOEmlOfrLzIcjANl3Rof Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 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 Signed-off-by: Ranbir Singh --- 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 1070516b35..cbe6bee2ab 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) { -=C2=A0 =C2=A0 =C2=A0 BlockSize =3D (UINT32)(((IdentifyData->AtaData.logic_= sector_size_hi << 16) | IdentifyData->AtaData.logic_sector_size_lo) * sizeo= f (UINT16)); +=C2=A0 =C2=A0 =C2=A0 BlockSize =3D (((UINT32)(IdentifyData->AtaData.logic_= sector_size_hi << 16) | IdentifyData->AtaData.logic_sector_size_lo) * sizeo= f (UINT16)); } } -- 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 (#97912): https://edk2.groups.io/g/devel/message/97912 Mute This Topic: https://groups.io/mt/96045596/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- --gOEmlOfrLzIcjANl3Rof Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable
Line number 1348 does contain a typecast with UINT32, but it is after<= /div>
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
Signed-off-by: Ranbir Singh <Ranbir.Singh3@Dell.com>
---
 MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.c | 2 +-<= /div>
 1 file changed, 1 insertion(+), 1 deletion(-)
 
diff --git a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.c = b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.c
index 1070516b35..cbe6bee2ab 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_sup= port & BIT12) !=3D 0) {
-      BlockSize =3D (UINT32)(((IdentifyData->AtaDat= a.logic_sector_size_hi << 16) | IdentifyData->AtaData.logic_sector= _size_lo) * sizeof (UINT16));
+      BlockSize =3D (((UINT32)(IdentifyData->AtaDat= a.logic_sector_size_hi << 16) | IdentifyData->AtaData.logic_sector= _size_lo) * sizeof (UINT16));
     }
   }
 
--
2.36.1.windows.1
_._,_._,_

Groups.io Links:

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

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

_._,_._,_
--gOEmlOfrLzIcjANl3Rof--