From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f172.google.com (mail-pf1-f172.google.com [209.85.210.172]) by mx.groups.io with SMTP id smtpd.web11.1836.1689266843600189876 for ; Thu, 13 Jul 2023 09:47:23 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@ventanamicro.com header.s=google header.b=pdJdAmya; spf=pass (domain: ventanamicro.com, ip: 209.85.210.172, mailfrom: rsingh@ventanamicro.com) Received: by mail-pf1-f172.google.com with SMTP id d2e1a72fcca58-666ecf9a0ceso640108b3a.2 for ; Thu, 13 Jul 2023 09:47:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1689266843; x=1691858843; 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=J5dkPKjo0zOPysUco9xhQrMbuLYKQekCkdjA5dKD7dA=; b=pdJdAmyavR2RSGuxltQvPP/mlhwu82gGfPzm82q5cOfGaQVaJ2zJxOjUGiM+PBjHZl HzPvEFSsPKqKNxZxQYdbyiZdg3ATaKRPqYLLvtpfeNJAUNP7jXJK7dCnkH7GhIpDjqWy T5np+dgKc7Kc60IBAsTQ/1MLTuO/d+VErEYyNKbTZlqIFck0UlQ23HGI7k5OfBxpNLDh CV+PCrOyTiQEPBwYlYEkUgwjOr6DcQ2fyCvwOfhnmjYsdrkjAQx4ucqw4/Tf7+Lv0/BO mrU1wlj03sWD4Rrw4TujMlCaNILxin3o0T+AIsmLFnkUEkOAFpjvizFw2EieLpJWdJYy yRSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689266843; x=1691858843; 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=J5dkPKjo0zOPysUco9xhQrMbuLYKQekCkdjA5dKD7dA=; b=cPijuqt0JKt6o5tyJkVdgD8hcRJHRqYMzgFeBfIH4rzWNo7j+gphwGEXy8RrGC12Dz z+hkKi4LyCJd0KSf94+/2GVSYbjtq81wTg6bXD707N1FX7ULslUuH2hiA2uzz6/nFa12 TwMShwq6KY3OJI1SKsrU2ZsJTVujxB1PaJb/S+eYfopfwlPEAfjGnkPJW+Y0AY7SM+wq YxZDMeVHftyweTi0qVG4xn175AFhVdT7Lw1n6MQYnNmxBRmL0loTFXOTg9Tlsu/fOo3s Gq6/ufNEE7GMCe86QiX8vegMyJ4GYpSVMfHBJSpO3z16zyLFW3wCu+DBpHK8jigDyM1o xcoA== X-Gm-Message-State: ABy/qLbTzJyil33DKTK3BybosRM/4lyxcvMZs1c7kjJmnMsM9K1prlGR 3bgFXGfChOlX8B9c93fUXa2+3olcuEn3R5Y58vg= X-Google-Smtp-Source: APBJJlGY+h6/GMFYQ0Ayi96HnZa//OS4+WOmaBewKQYgDNUa6TfZxqpFUEhTN8vZzmg3W1RhHon9Ag== X-Received: by 2002:a17:902:b68f:b0:1b9:e9f3:44c3 with SMTP id c15-20020a170902b68f00b001b9e9f344c3mr1450757pls.4.1689266842952; Thu, 13 Jul 2023 09:47:22 -0700 (PDT) Return-Path: Received: from user-Latitude-5420.dc1.ventanamicro.com ([2401:4900:1cbd:8dd2:35e7:16dd:8a1f:72c5]) by smtp.gmail.com with ESMTPSA id x13-20020a170902b40d00b001b8c3c7b102sm6190320plr.127.2023.07.13.09.47.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jul 2023 09:47:22 -0700 (PDT) From: Ranbir Singh To: devel@edk2.groups.io, rsingh@ventanamicro.com Cc: Hao A Wu , Ray Ni Subject: [PATCH v3 1/2] MdeModulePkg/Bus/Ata/AtaAtapiPassThru: Fix SIGN_EXTENSION Coverity issue Date: Thu, 13 Jul 2023 22:17:14 +0530 Message-Id: <20230713164715.1734745-2-rsingh@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230713164715.1734745-1-rsingh@ventanamicro.com> References: <20230713164715.1734745-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 Reviewed-by: Hao A Wu --- 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