Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3645467pxb; Mon, 24 Jan 2022 14:18:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJxZef/KiTXYZZdfGpUm0cDWSqL+Nxh9lq0ijgoCsmL4Yvw42ontlkFJXt4Fui72aLwHSJgL X-Received: by 2002:a17:902:d505:b0:14b:ce9:800e with SMTP id b5-20020a170902d50500b0014b0ce9800emr15896460plg.1.1643062683607; Mon, 24 Jan 2022 14:18:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643062683; cv=none; d=google.com; s=arc-20160816; b=WJB56VL/sKD7yp4lrxMBUNMkNswMJpAyvKxEubX1yg4feVKhqrPCF4MDE+ieCtxU6t dm4JFZNP7/82lDhQV/++xaMyrYVb9+1u/4DcdBYXZh6s94FYgyEXQNJcVBc8xDFpPj92 yayyxZDt5Od9sY5q5wEZqMCaDnuO/2LnrbLvEQmIpdy6GzCI0kVqzeWEoWFGYOci+PaR XFcDKZK+wXBu5YEJOnujQ6VW/wLhNamuLA8AabN1t0siq9Lr7MbCupgw/vLz88I3N7X7 EaIYBt7dUmw/iHVoxXTajA1q4EElj9Kb23u1UR9gx0W0elEauAMhZgmVp2iHIuGRdXwI DpBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=g2QYq/np4z46oKimKmYO1dwe3MNb3eTbJLZ/ihg80XE=; b=0yEXOnA3BYM1YBx+1Rw1xICDmd7uxxTPfxDhVvlcdMLKA14bvfwvIWAbqNo09cotqI 9FMORsGn0aqAl2acWTkMJ+qGiTxVrTnHrJHBW+fLgD+sQrvr4G+c3kmFodbcyFBSJoru IZBsvvltziys36Du/hyK+SveCx3WbNRy7U/g4kS6HQRKiaEVJ7cNCEPt6mRuFD/JVxEJ 5YExRT/CKg68n7cl5lzluWfDZHW48VWT/MMf8kucDtUXtDZ8Se9iFiT8xiOK2BZOIKSm vF1avzL2vpUXs+G/AgpZaqopGY9ufjz/APj/W6P435xO5RzDOjmyaFMR8dRfIkowCFip 0D3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qhpAuxy3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g22si468789pji.142.2022.01.24.14.17.44; Mon, 24 Jan 2022 14:18:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qhpAuxy3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356617AbiAXWNA (ORCPT + 99 others); Mon, 24 Jan 2022 17:13:00 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:50556 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442444AbiAXV3f (ORCPT ); Mon, 24 Jan 2022 16:29:35 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 44EB461320; Mon, 24 Jan 2022 21:29:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3089FC340E4; Mon, 24 Jan 2022 21:29:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059774; bh=hY4UWMyFSq0Q4bgph2NQBK7SyoqPgPe9sNmHDQXYo1o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qhpAuxy3N/XCubNi1O8kk+FbRLJT08L9Ln4z0WQzYKNFGVezusoITVJhohW2AjSR9 VhAjP1P3UBA0CK90uUyMUajWOMBuGkrjyHvgjqmxQPVpx2t57aXo/y/RLc7Nuur9lj lJu7klDTqJ98NF2BE4MZEZpo4ywjfSNPQNUwcve4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mark Langsdorf , Bob Moore , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.16 0696/1039] ACPICA: actypes.h: Expand the ACPI_ACCESS_ definitions Date: Mon, 24 Jan 2022 19:41:25 +0100 Message-Id: <20220124184148.736451659@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mark Langsdorf [ Upstream commit f81bdeaf816142e0729eea0cc84c395ec9673151 ] ACPICA commit bc02c76d518135531483dfc276ed28b7ee632ce1 The current ACPI_ACCESS_*_WIDTH defines do not provide a way to test that size is small enough to not cause an overflow when applied to a 32-bit integer. Rather than adding more magic numbers, add ACPI_ACCESS_*_SHIFT, ACPI_ACCESS_*_MAX, and ACPI_ACCESS_*_DEFAULT #defines and redefine ACPI_ACCESS_*_WIDTH in terms of the new #defines. This was inititally reported on Linux where a size of 102 in ACPI_ACCESS_BIT_WIDTH caused an overflow error in the SPCR initialization code. Link: https://github.com/acpica/acpica/commit/bc02c76d Signed-off-by: Mark Langsdorf Signed-off-by: Bob Moore Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- include/acpi/actypes.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h index ff8b3c913f217..248242dca28d3 100644 --- a/include/acpi/actypes.h +++ b/include/acpi/actypes.h @@ -536,8 +536,14 @@ typedef u64 acpi_integer; * Can be used with access_width of struct acpi_generic_address and access_size of * struct acpi_resource_generic_register. */ -#define ACPI_ACCESS_BIT_WIDTH(size) (1 << ((size) + 2)) -#define ACPI_ACCESS_BYTE_WIDTH(size) (1 << ((size) - 1)) +#define ACPI_ACCESS_BIT_SHIFT 2 +#define ACPI_ACCESS_BYTE_SHIFT -1 +#define ACPI_ACCESS_BIT_MAX (31 - ACPI_ACCESS_BIT_SHIFT) +#define ACPI_ACCESS_BYTE_MAX (31 - ACPI_ACCESS_BYTE_SHIFT) +#define ACPI_ACCESS_BIT_DEFAULT (8 - ACPI_ACCESS_BIT_SHIFT) +#define ACPI_ACCESS_BYTE_DEFAULT (8 - ACPI_ACCESS_BYTE_SHIFT) +#define ACPI_ACCESS_BIT_WIDTH(size) (1 << ((size) + ACPI_ACCESS_BIT_SHIFT)) +#define ACPI_ACCESS_BYTE_WIDTH(size) (1 << ((size) + ACPI_ACCESS_BYTE_SHIFT)) /******************************************************************************* * -- 2.34.1