From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9D5223DD507; Tue, 31 Mar 2026 16:27:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774974436; cv=none; b=Exi2ejTP4O/BzEsBtIM+5c1IHFNxhF4edhwBE+0cynsaiMSRm1+u1MHp8zNWUk587jq1UJK7K+NU0A2Wx8Xkbchbz6LYaS/jXU/BK/5RBZ2gaoj1V4ugZwNF5dJDaK/dUZVc91oy+RA51Wou0UL0UsEtuYGgbBLIgoRU3OBMnIE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774974436; c=relaxed/simple; bh=mF+H9r87XSDDP4ZRmDpCK8Q7Fy2TeQOQZ9nuR1Argis=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cqO6+Ikp/V3H5FH+tHOEPjRyPyU1RjWf9kHjRpA7l2PNWCV23BA7atTBWEIDldrl1V8tmRMiwgJ6pdINrDkdgpo3GzLzhKpFEQ5D3uhVLY7d+CBnO/zmGxXeo4bihhMczeHcA7lrjaPTC/QWezQzJS3vBL5kr3gIhuUDxmXWfS0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=FYCzImex; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="FYCzImex" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E69B2C19423; Tue, 31 Mar 2026 16:27:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1774974436; bh=mF+H9r87XSDDP4ZRmDpCK8Q7Fy2TeQOQZ9nuR1Argis=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FYCzImexdiIQgP7dBoPEGWqutnu8JETWKwsVU0LYeZOj6l2VXY2yaGIKHdfTkiYSD Fr/fHOiOmXjzRFp4pC89HFZGA0A4sB+HAmb+rx/B4dUmUQsWdnXjaGH+lThvE//OZP UUdI4Mcj1cUu96BqQ0XkZcRR5N8VNVEQa1CcinsE= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Guenter Roeck , "Mike Rapoport (Microsoft)" , Ard Biesheuvel , Sasha Levin Subject: [PATCH 6.6 085/175] x86/efi: efi_unmap_boot_services: fix calculation of ranges_to_free size Date: Tue, 31 Mar 2026 18:21:09 +0200 Message-ID: <20260331161732.895039751@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260331161729.779738837@linuxfoundation.org> References: <20260331161729.779738837@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Mike Rapoport (Microsoft) [ Upstream commit 217c0a5c177a3d4f7c8497950cbf5c36756e8bbb ] ranges_to_free array should have enough room to store the entire EFI memmap plus an extra element for NULL entry. The calculation of this array size wrongly adds 1 to the overall size instead of adding 1 to the number of elements. Add parentheses to properly size the array. Reported-by: Guenter Roeck Fixes: a4b0bf6a40f3 ("x86/efi: defer freeing of boot services memory") Signed-off-by: Mike Rapoport (Microsoft) Signed-off-by: Ard Biesheuvel Signed-off-by: Sasha Levin --- arch/x86/platform/efi/quirks.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/platform/efi/quirks.c b/arch/x86/platform/efi/quirks.c index df3b45ef1420c..a29efaf6fe411 100644 --- a/arch/x86/platform/efi/quirks.c +++ b/arch/x86/platform/efi/quirks.c @@ -424,7 +424,7 @@ void __init efi_unmap_boot_services(void) if (efi_enabled(EFI_DBG)) return; - sz = sizeof(*ranges_to_free) * efi.memmap.nr_map + 1; + sz = sizeof(*ranges_to_free) * (efi.memmap.nr_map + 1); ranges_to_free = kzalloc(sz, GFP_KERNEL); if (!ranges_to_free) { pr_err("Failed to allocate storage for freeable EFI regions\n"); -- 2.53.0