Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3576687pxb; Mon, 24 Jan 2022 12:38:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJwhbu2NsQZdABT0F/nQD3PFhuMKGRtITo2BkQmCQk2fExUwM4Qi6scE8pilYHQQRmeMkPHV X-Received: by 2002:a17:902:aa8b:b0:148:ee33:70fe with SMTP id d11-20020a170902aa8b00b00148ee3370femr15737124plr.38.1643056680353; Mon, 24 Jan 2022 12:38:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643056680; cv=none; d=google.com; s=arc-20160816; b=ctYq4W7bh9fCrIBHQma+zXdQHwAYXm9iqT76UugRTvF+NEra70HIaE55uWDQCDEbmQ 9iHnl4wX7xcsAaTRTgOcpSidln9Dq6cAV0PLTVlO8O8ezCDUNN7F0op4FIxZdraOQY1Q czyeizbyYT2qSuucKtgHyGOAVmgnyspnENN80KI6AvGfHkPr31ekLdobJuQS9wuuczhk rI2U7v+wVnlRm0gwmchg6P64blUaZ/iFcc2EJTJyFCUJ4O78ddp6wsm3thlm7Nzvihhv CD/jKsvzrJrplSnI9h4p0oT+kNloQwG+7rPneuucd77Gut7/L4eeMzXECZmfabTs/v7o ECIQ== 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=nMnUXw+I+5rONlszltSkLP4zV2Z1ypAPku+QCDsGmLQ=; b=IgUMuz9UKJK25QchqNQdLsEMHN2CEKffvdWOqX1RTmEUoaXI8uFeaU21N+hy2e5Wd0 2130vEmRaddWj/e6Gh02mZAqddZTr4/bYmQVuGG3DeTAOCJaSE+ZYNkcnEGvLkpFgWqa BKFSfImZLTLQ2Su3AoZH7LSVXj0tDcAuOQ95mR+vRLDsXw8M+MgS+QN83TQ0PMwxOuiM 6BFYL4GiiQTKeC5f7xiCZ57gScCg/n2t3nlJOtGbC5UleQAnt/H2tox5ajl5roQmVsgS BTK+wvC41CdaG+IkRr3LXXOuF5den5FIGT68vEt+qofrG0r5l48xGF0o/yH3qzUmdNaX BMHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QsCObvFy; 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 g15si16465887pfc.227.2022.01.24.12.37.48; Mon, 24 Jan 2022 12:38:00 -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=QsCObvFy; 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 S1355963AbiAXTpA (ORCPT + 99 others); Mon, 24 Jan 2022 14:45:00 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:58070 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354158AbiAXTgI (ORCPT ); Mon, 24 Jan 2022 14:36:08 -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 ams.source.kernel.org (Postfix) with ESMTPS id C0C12B810AF; Mon, 24 Jan 2022 19:36:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D9AD4C340E5; Mon, 24 Jan 2022 19:36:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052965; bh=17uZWNwcuXXwaurrShXeLBZ0t+Jwvjam9BBI+xKfecg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QsCObvFyeFtQSKB2P5j/QDzrQ/02w3AEol8NWkA8I7OsyHK5OVMAi/cPFWxzg8+1q FlYyp+zpZ4+Jop5nyfK70XRunHYXwyqeLvdW7pLX//Rh29FPha0e1L4pGQoS+a704R U3q/b2ZYB/x9KhMpEmqt0Qr6aw3Qk9HP4grLMVaI= 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.4 204/320] ACPICA: actypes.h: Expand the ACPI_ACCESS_ definitions Date: Mon, 24 Jan 2022 19:43:08 +0100 Message-Id: <20220124184000.573255237@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@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 9373662cdb44f..ff5fecff51167 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