From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id B201F7803CF for ; Wed, 2 Aug 2023 04:27:05 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=EwcrpbSW8KvzqnQhSMQnYNIcZNvdrWagmenRWFF/QlQ=; c=relaxed/simple; d=groups.io; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:To:Cc:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Type; s=20140610; t=1690950424; v=1; b=qCyjudhRxdeZ+g8ZCvyWURGiQlEx3odsu8els2z4k2y1KuOECyGUgOie3J86NHGRTHjujk66 tNGVmlwnf/BnlMfTlovZl3yxn2EEmlAntGAZYH03ceHECIsOVOYOjNYtOo7e9CfWsaagzSjacw+ VBvnCEJOf9ThG4yoGKfPbJ6U= X-Received: by 127.0.0.2 with SMTP id yTf2YY7687511x3DG9Hyp5mv; Tue, 01 Aug 2023 21:27:04 -0700 X-Received: from mail-pg1-f179.google.com (mail-pg1-f179.google.com [209.85.215.179]) by mx.groups.io with SMTP id smtpd.web11.7448.1690950423694938484 for ; Tue, 01 Aug 2023 21:27:03 -0700 X-Received: by mail-pg1-f179.google.com with SMTP id 41be03b00d2f7-55ae2075990so4002422a12.0 for ; Tue, 01 Aug 2023 21:27:03 -0700 (PDT) X-Gm-Message-State: lQ96bxIbx9Np0MpGeiyy711Px7686176AA= X-Google-Smtp-Source: APBJJlGNg/08OKqgb0ghsSljUKBAwioXuCZz7NOgaBrpi0dMEaP400Hzcwn9W3Bpp/jqFHEncdxahSbv24bbtdsq8wM= X-Received: by 2002:a17:90b:1003:b0:25e:d727:6fb4 with SMTP id gm3-20020a17090b100300b0025ed7276fb4mr12646267pjb.2.1690950422561; Tue, 01 Aug 2023 21:27:02 -0700 (PDT) MIME-Version: 1.0 References: <20230717115910.2291824-1-rsingh@ventanamicro.com> <20230717115910.2291824-2-rsingh@ventanamicro.com> In-Reply-To: <20230717115910.2291824-2-rsingh@ventanamicro.com> From: "Ranbir Singh" Date: Wed, 2 Aug 2023 09:56:51 +0530 Message-ID: Subject: Re: [edk2-devel] [PATCH v2 1/1] MdeModulePkg/Bus/Ata/AtaBusDxe: Fix SIGN_EXTENSION Coverity issue To: devel@edk2.groups.io, rsingh@ventanamicro.com Cc: Hao A Wu , Ray Ni Precedence: Bulk 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 List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: Content-Type: multipart/alternative; boundary="00000000000045190b0601e913f4" X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=qCyjudhR; dmarc=none; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io --00000000000045190b0601e913f4 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Hao, Just bringing this one to your attention in case it has got buried down under ... On the same lines as the following merged today - https://github.com/tianocore/edk2/commit/c7c1170a4568ecc0f63e14ca6a844d40f4= 7519a9 Best Regards, Ranbir Singh On Mon, Jul 17, 2023 at 5:29=E2=80=AFPM Ranbir Singh wrote: > From: Ranbir Singh > > 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 > > Cc: Hao A Wu > Cc: Ray Ni > Signed-off-by: Ranbir Singh > 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/MdeModulePkg/Bus/Ata/AtaBusDxe/AtaPassThruExecute.c > index a77852bae054..57aefa04c215 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) { > - BlockMedia->BlockSize =3D > (UINT32)(((IdentifyData->logic_sector_size_hi << 16) | > IdentifyData->logic_sector_size_lo) * sizeof (UINT16)); > + BlockMedia->BlockSize =3D > (UINT32)(((UINT32)(IdentifyData->logic_sector_size_hi << 16) | > IdentifyData->logic_sector_size_lo) * sizeof (UINT16)); > } > > AtaDevice->BlockIo.Revision =3D EFI_BLOCK_IO_PROTOCOL_REVISION2; > -- > 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 (#107443): https://edk2.groups.io/g/devel/message/107443 Mute This Topic: https://groups.io/mt/100212118/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- --00000000000045190b0601e913f4 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Hao,

Just bringing this one to your = attention in case it has got buried down under ...

On the same lines as the following merged today -

Best Regards,
Ranb= ir Singh


On Mon, Jul 17, 2023 at 5:29=E2=80=AFPM Ranbi= r Singh <rsingh@ventanamicro.= com> wrote:
From: Ranbir Singh <Ranbir.Singh3@Dell.com>

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.c= gi?id=3D4209

Cc: Hao A Wu <ha= o.a.wu@intel.com>
Cc: Ray Ni <ray.ni= @intel.com>
Signed-off-by: Ranbir Singh <Ranbir.Singh3@Dell.com>
Signed-off-by: Ranbir Singh <rsingh@ventanamicro.com>
---
=C2=A0MdeModulePkg/Bus/Ata/AtaBusDxe/AtaPassThruExecute.c | 2 +-
=C2=A01 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MdeModulePkg/Bus/Ata/AtaBusDxe/AtaPassThruExecute.c b/MdeModul= ePkg/Bus/Ata/AtaBusDxe/AtaPassThruExecute.c
index a77852bae054..57aefa04c215 100644
--- a/MdeModulePkg/Bus/Ata/AtaBusDxe/AtaPassThruExecute.c
+++ b/MdeModulePkg/Bus/Ata/AtaBusDxe/AtaPassThruExecute.c
@@ -362,7 +362,7 @@ IdentifyAtaDevice (
=C2=A0 =C2=A0 =C2=A0// Check logical block size
=C2=A0 =C2=A0 =C2=A0//
=C2=A0 =C2=A0 =C2=A0if ((PhyLogicSectorSupport & BIT12) !=3D 0) {
-=C2=A0 =C2=A0 =C2=A0 BlockMedia->BlockSize =3D (UINT32)(((IdentifyData-= >logic_sector_size_hi << 16) | IdentifyData->logic_sector_size_= lo) * sizeof (UINT16));
+=C2=A0 =C2=A0 =C2=A0 BlockMedia->BlockSize =3D (UINT32)(((UINT32)(Ident= ifyData->logic_sector_size_hi << 16) | IdentifyData->logic_sect= or_size_lo) * sizeof (UINT16));
=C2=A0 =C2=A0 =C2=A0}

=C2=A0 =C2=A0 =C2=A0AtaDevice->BlockIo.Revision =3D EFI_BLOCK_IO_PROTOCO= L_REVISION2;
--
2.34.1

_._,_._,_

Groups.io Links:

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

View/Reply Online (#107443) | =20 | Mute= This Topic | New Topic
Your Subscriptio= n | Contact Group Owner | Unsubscribe [rebecca@openfw.io]

_._,_._,_
--00000000000045190b0601e913f4--