From mboxrd@z Thu Jan 1 00:00:00 1970 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 Authentication-Results: mx.groups.io; dkim=fail reason="signature has expired" header.i=@ventanamicro.com header.s=google header.b=HB2WUesY; spf=pass (domain: ventanamicro.com, ip: 209.85.210.67, mailfrom: rsingh@ventanamicro.com) Received: by mail-ot1-f67.google.com with SMTP id 46e09a7af769-6b2a4655352so595543a34.3 for ; Fri, 09 Jun 2023 05:33:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1686314011; x=1688906011; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=OKHV/zKfwr9/CzkMd6ZPLMtGKSkBlQaOh6q4ZEBx5Mk=; b=HB2WUesYmytxpuJ47I56lyNNmz6FgIuVPaBj37yBAlOhLFvKzoXMz0ONp9XnoSThj1 dmRbOzdLH8QaSP+/2NlzWCPSnolwKU/GCqLr1SRcA+vjiMiAuvpfDCSgloO3Q7WIUujX O2nKUgc+VP8Wcvo7xVGnGRiZNUdVqfvvdSNRFdATfkg1mQp20wLy9ux378Kb6v+K2rrX bCTgR3Nz/XkDOnXFbD6RtoJ8Y1oIFtbydV2WL/JtCsTDO3eNrSuynoVVggzvkLAmNtHU BjBUxQUK4ph10iWV5KZ8XtIDtW1JmcVbE1RfNbjtawHwRglHcnHZvf4wnyxJF6M+9XME PlgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686314011; x=1688906011; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=OKHV/zKfwr9/CzkMd6ZPLMtGKSkBlQaOh6q4ZEBx5Mk=; b=Lx+PzAJGsJSEAlYJFh9bHHztKrjejk2u3BuCtA6vDASGS/44SwKzx2d+Eqg3X6H3zW HKM3HnLhMOgZppuHxbFC4UceDVsh5VYOeAfVSbC6Z6iXydJsfejX3wD6itz1B5XNAvso LYJkw8rfIwLikRw6Oz3srz7fT3rvNNY8LoWqmh+1imN1luA2JTOsb2YZMmIseGS3rjAF dH2PGXcVAynV9hd+VJwHvtC3J4YNvL8g5USftvZbzy/FU7/730h6uxT3JCLh9EeoBxET wuLQr1yVxrM9Gy5qy7qZJVGErFLRh5DhlpDYvKJSui9GSBbGbdpst0mKqzDg1Lgzzi6t +xpg== X-Gm-Message-State: AC+VfDxccZ1dD5zfSlRoJb7yqAO9tVQv767sSP2cNrTYjmVOUkE3tJbd eLfPf5QWKZFm1obOd6LtGxqb7UnLPzrGPjxym7boLUFh 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) Return-Path: 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: [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> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230609123322.191390-1-rsingh@ventanamicro.com> References: <20230609123322.191390-1-rsingh@ventanamicro.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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 --- 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=0D //=0D if ((IdentifyData->AtaData.phy_logic_sector_support & BIT12) !=3D 0) {= =0D - BlockSize =3D (UINT32)(((IdentifyData->AtaData.logic_sector_size_hi = << 16) | IdentifyData->AtaData.logic_sector_size_lo) * sizeof (UINT16));=0D + BlockSize =3D (UINT32)(((UINT32)(IdentifyData->AtaData.logic_sector_= size_hi << 16) | IdentifyData->AtaData.logic_sector_size_lo) * sizeof (UINT= 16));=0D }=0D }=0D =0D --=20 2.34.1