From nobody Sun Feb 8 21:28:52 2026 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+110818+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+110818+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1699338535; cv=none; d=zohomail.com; s=zohoarc; b=E15v1Z1bT1T5ibtIwFZ0G++VfDyqYIb4uchwtGHejKIINw0O+LlES45miBjWVv3OOI/pKDN9gysLx2NQD3uF2NJEFjFvZY1Xvv0PjO/ecyK7JZfdvkUQQb0rXKBx6ETYGLt/EDGpFQbNugOTYBlVBbRX293hUt+F1Y14FYuAo2Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1699338535; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=PC25vHh0ypD0uEFj0m0qucHqEnpBuOq3GQsbB1wwb+w=; b=BewL4DKh5sP4i2n6egfFXrN8CHbiW7pu9YtljqW58nioplg97rnANP2Zk3xvulOpvq1/93LJU7YMjjtlThK1LvHqzctdvmgpHoKUKXmDYK8XJxZyeMCI++G7HnUtSIGHvEkI82npNuPglFXqnmIqcqAeXjCa7AN6f39jOVaWFEU= 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+110818+1787277+3901457@groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 169933853589144.98803317672025; Mon, 6 Nov 2023 22:28:55 -0800 (PST) Return-Path: DKIM-Signature: a=rsa-sha256; bh=5uKzJPCZFREkxoKyeVdelseavzyR8GJhyqDo2+Ez4vQ=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20140610; t=1699338535; v=1; b=HkWEyNlXXV5F6verG/9pIaLuv+RCT+KB05BvFk+kZwQZu8CGi8Hdg9hxivb6Pkc/z4U5h+RQ YkAuavIOw5mROlkugFKosuAyRyZk+R6BVUphB09SwGqcD2fBY/+v/dfluRjM9KsKFsYfKo9uvi/ pBh95fGt1AUZoalWKE4yxrQU= X-Received: by 127.0.0.2 with SMTP id JydGYY1788612xW6CwsnB9CT; Mon, 06 Nov 2023 22:28:55 -0800 X-Received: from mail-io1-f53.google.com (mail-io1-f53.google.com [209.85.166.53]) by mx.groups.io with SMTP id smtpd.web10.5112.1699338535000684796 for ; Mon, 06 Nov 2023 22:28:55 -0800 X-Received: by mail-io1-f53.google.com with SMTP id ca18e2360f4ac-7a996357550so207751139f.2 for ; Mon, 06 Nov 2023 22:28:54 -0800 (PST) X-Gm-Message-State: v8Wj6CSHO81eOClxfYVQdI8Px1787277AA= X-Google-Smtp-Source: AGHT+IGaE+bywZI/r//TVzV8brCVl/bGoILM6L/gLJyOs5p4WmazRnTFezc+OMkMUM8DLAiogEat1g== X-Received: by 2002:a05:6e02:1909:b0:357:43a5:acf8 with SMTP id w9-20020a056e02190900b0035743a5acf8mr2690839ilu.17.1699338533965; Mon, 06 Nov 2023 22:28:53 -0800 (PST) X-Received: from user-Latitude-5420.dc1.ventanamicro.com ([2401:4900:1f24:775d:7335:84a5:7d11:9393]) by smtp.gmail.com with ESMTPSA id c7-20020a0290c7000000b00463ff17540fsm1766626jag.78.2023.11.06.22.28.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 22:28:53 -0800 (PST) From: "Ranbir Singh" To: devel@edk2.groups.io, rsingh@ventanamicro.com Cc: Ray Ni , Veeresh Sangolli Subject: [edk2-devel] [PATCH v2 2/2] FatPkg/EnhancedFatDxe: Fix OVERFLOW_BEFORE_WIDEN Coverity issue Date: Tue, 7 Nov 2023 11:58:42 +0530 Message-Id: <20231107062842.116670-3-rsingh@ventanamicro.com> In-Reply-To: <20231107062842.116670-1-rsingh@ventanamicro.com> References: <20231107062842.116670-1-rsingh@ventanamicro.com> MIME-Version: 1.0 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-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1699338537714100003 Content-Type: text/plain; charset="utf-8" From: Ranbir Singh The function FatInitializeDiskCache evaluates an expression FAT_DATACACHE_GROUP_COUNT << DiskCache[CacheData].PageAlignment and assigns it to DataCacheSize which is of type UINTN. As per Coverity report, FAT_DATACACHE_GROUP_COUNT << DiskCache[CacheData].PageAlignment is a potentially overflowing expression with type "int" (32 bits, signed) evaluated using 32-bit arithmetic, and then used in a context that expects an expression of type "UINTN" (64 bits, unsigned). To avoid overflow, cast "FAT_DATACACHE_GROUP_COUNT" to type "UINTN". REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4249 Cc: Ray Ni Co-authored-by: Veeresh Sangolli Signed-off-by: Ranbir Singh Signed-off-by: Ranbir Singh --- FatPkg/EnhancedFatDxe/DiskCache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FatPkg/EnhancedFatDxe/DiskCache.c b/FatPkg/EnhancedFatDxe/Disk= Cache.c index d1a34a6a646f..d56e338586d8 100644 --- a/FatPkg/EnhancedFatDxe/DiskCache.c +++ b/FatPkg/EnhancedFatDxe/DiskCache.c @@ -477,7 +477,7 @@ FatInitializeDiskCache ( DiskCache[CacheFat].BaseAddress =3D Volume->FatPos; DiskCache[CacheFat].LimitAddress =3D Volume->FatPos + Volume->FatSize; FatCacheSize =3D FatCacheGroupCount << DiskCache[Ca= cheFat].PageAlignment; - DataCacheSize =3D FAT_DATACACHE_GROUP_COUNT << DiskC= ache[CacheData].PageAlignment; + DataCacheSize =3D (UINTN)FAT_DATACACHE_GROUP_COUNT <= < DiskCache[CacheData].PageAlignment; // // Allocate the Fat Cache buffer // --=20 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 (#110818): https://edk2.groups.io/g/devel/message/110818 Mute This Topic: https://groups.io/mt/102438365/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-