Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3560986pxb; Mon, 24 Jan 2022 12:14:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJxfnBKzHUqDmkWPeM0DAPg6rOczjVjucE/ZpvVv5krmMeFQL3tVkPkjPQ4uu8UoQ9SVHPLn X-Received: by 2002:a63:4456:: with SMTP id t22mr12889593pgk.52.1643055287406; Mon, 24 Jan 2022 12:14:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643055287; cv=none; d=google.com; s=arc-20160816; b=TC+9ttTZMUaz1bEPSdkB16Ig3xY9UJdOmNdTGCVwA21A210Ye1IBWkCYFJ+JaVK7iv ByFqYNGlGu18c1e/cXkIOXmJvzFw7FXD9jFqoHbHGhpVt45HaEROcOZ6C7xjmnc56IwF eCwCxx7no6P4EE/zvT1Ju0j8VR20zJpob+7wDW1xUpUJdmCAfg2f9JEV2kXaWvxDEpDd tpbvLTZF5RQXaxRcoG7awm3+5+uIrKYn3/y2iR/orp6gWQvwXrZAIPDAHA49klhdGGGu YEMG/YNULsyLcqn4nu/S+1J6W6bD3VBpKf0vKaIdTWSYPcTppd21yCY4gdV0c+RlwU8u KyjQ== 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=G90aPN3r2qCXxW2/4jqyVh3+BELWKyjxVx52dw08ays=; b=JRZyrpx5M0FCSTbCZSBc/p8FzhEzqnDz3vdRicI2q9H86kHZxM9O3xJQP2nLCMZvFQ qtUhZ/s1Y5CgtdCsSYNC/aq8XkI3h0HqprzARAaxL0xQmw8mtnX8e6hu+4cL09pVOdmw We8OzmQ7dR2rLv+AqEweynLjIJiybW5C02Hg30HB50HAeo0njmAvwvgsE9i/HiqyOEHo lVmaYVVgGlBHqrsAOH66M73JKnjTk8Ryxco8v7Zd7r7JJO4SBsKYOBbHltayRR+oCv71 wWdBXG6y0yEOIdQ1BHEguIuk0ynA/nUq5IhVHK8HSgMbS+mswBr9Cj4fmhsPoEm5m/v6 w+8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=oQ7nlGJ9; 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 w7si14957724plg.323.2022.01.24.12.14.35; Mon, 24 Jan 2022 12:14:47 -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=oQ7nlGJ9; 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 S1345239AbiAXTSE (ORCPT + 99 others); Mon, 24 Jan 2022 14:18:04 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:36230 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346828AbiAXTIT (ORCPT ); Mon, 24 Jan 2022 14:08:19 -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 5A9A66121F; Mon, 24 Jan 2022 19:08:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1DE94C340E7; Mon, 24 Jan 2022 19:08:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643051298; bh=iG87uSHs6Uxi9pA35W4fWuC2vqqSy6dBDllOCeBnKQ8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oQ7nlGJ9hzhHFl5UBMPGctguYE+H27sQPP+zgl71C91DpedHAYy7TlC8lRE540/Iz pgZEDkPuxiivbpot81izt7Gwu4gzJ1e41n0l9S0XuwNtDqTS/9wGYnh2L5ArGOYrF4 UEGMw0NcDjmSQ76a2WvsKbutuhSqKbPsyq2wZMgM= 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 4.14 118/186] ACPICA: actypes.h: Expand the ACPI_ACCESS_ definitions Date: Mon, 24 Jan 2022 19:43:13 +0100 Message-Id: <20220124183940.910320823@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183937.101330125@linuxfoundation.org> References: <20220124183937.101330125@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 71fadbe77e211..2c5df69e67819 100644 --- a/include/acpi/actypes.h +++ b/include/acpi/actypes.h @@ -560,8 +560,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