From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5019ACCD184 for ; Fri, 17 Oct 2025 08:16:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AA9F48E003F; Fri, 17 Oct 2025 04:16:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9E5078E0016; Fri, 17 Oct 2025 04:16:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8D43E8E003F; Fri, 17 Oct 2025 04:16:23 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 726F58E0016 for ; Fri, 17 Oct 2025 04:16:23 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 2B7781605AC for ; Fri, 17 Oct 2025 08:16:23 +0000 (UTC) X-FDA: 84006899046.04.73F65D6 Received: from sea.source.kernel.org (sea.source.kernel.org [172.234.252.31]) by imf17.hostedemail.com (Postfix) with ESMTP id 7D1324000E for ; Fri, 17 Oct 2025 08:16:21 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=fail ("body hash did not verify") header.d=linuxfoundation.org header.s=korg header.b=Ljnhb1SV; dmarc=pass (policy=none) header.from=linuxfoundation.org; spf=pass (imf17.hostedemail.com: domain of gregkh@linuxfoundation.org designates 172.234.252.31 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1760688981; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:dkim-signature; bh=EohpMiVWnXh7nkx7DDLhqem6p5VXDDblshphr99e540=; b=0RZXutKbqykoQY/oKcWfQBJbatzpJyK+K1m+EtjPFPBawW+AyPrzDO2Q5YpdBml9ZNi1w9 Dh0t0aw8Nki1UIjjHk7rMo5qU1xlZ4mHCEYqIcnTKU3xnt5qfBhk+rcXjnlkb/ietkVMiT /yMq969JUj1MJ/UCirdClp3CvzPBX0c= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=fail ("body hash did not verify") header.d=linuxfoundation.org header.s=korg header.b=Ljnhb1SV; dmarc=pass (policy=none) header.from=linuxfoundation.org; spf=pass (imf17.hostedemail.com: domain of gregkh@linuxfoundation.org designates 172.234.252.31 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1760688981; a=rsa-sha256; cv=none; b=xPZdO4hjhBoj8UN6YbN8ZmaPSh8GPYYlyxXOhWsd8Pk6a3IXGpRZgWUgkI36GxKFHsu0cF MzEWlAoPf/JHfRRfBPgyPMAe2c+yb0h2zBxZ1JfitR/616TsMgNORjDPeONtD0OfY8F+Nx QQ2FeQQAcPq/dkgLTbKTsLMRBu/Z05M= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id 746A241B61; Fri, 17 Oct 2025 08:16:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B98EFC4CEFE; Fri, 17 Oct 2025 08:16:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1760688980; bh=KGscHLo4lmwttty+FbyKIhMbZVDGdMbkHROcEjxJKR4=; h=Subject:To:Cc:From:Date:In-Reply-To:From; b=Ljnhb1SV3+uNrpurZLUI7wIbg8U95WGLdT+ziKWmAFefAX0AEi/bTB9q+xQWuLXSj RIqHN6IABcpRyHupKXDSqp3U6LsD0mI0JK6Jqxelvm3YK52yddKOjIH75HrkcNw7kM /rikgip+gGkoylbYO7BA6JNw3nHTSjYC8AY9HWgI= Subject: Patch "minmax: don't use max() in situations that want a C constant expression" has been added to the 5.15-stable tree To: David.Laight@ACULAB.COM, David.Laight@aculab.com, adilger.kernel@dilger.ca, agk@redhat.com, airlied@linux.ie, akpm@linux-foundation.org, amd-gfx@lists.freedesktop.org, andriy.shevchenko@linux.intel.com, anton.ivanov@cambridgegreys.com, bp@alien8.de, clm@fb.com, coreteam@netfilter.org, daniel@ffwll.ch, dave.hansen@linux.intel.com, davem@davemloft.net, dm-devel@redhat.com, dmitry.torokhov@gmail.com, dri-devel@lists.freedesktop.org, dsahern@kernel.org, dsterba@suse.com, dushistov@mail.ru, farbere@amazon.com, freedreno@lists.freedesktop.org, fw@strlen.de, gregkh@linuxfoundation.org, hdegoede@redhat.com, herve.codina@bootlin.com, hpa@zytor.com, jack@suse.com, james.morse@arm.com, jdelvare@suse.com, jdike@addtoit.com, jejb@linux.ibm.com, jernej.skrabec@gmail.com, jmaloy@redhat.com, josef@toxicpanda.com, kadlec@netfilter.org, krzysztof.kozlowski@canonical.com, kuba@kernel.org, linus.walleij@linaro.org, linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org, linux-staging@lists.linux.dev, linux-stm32@st-md-mailman.stormreply.co, m@kvack.org, linux-sunxi@lists.linux.dev, linux-um@lists.infradead.org, linux@rasmusvillemoes.dk, linux@roeck-us.net, lorenzo.stoakes@oracle.com, luc.vanoostenryck@gmail.com, luto@kernel.org, maarten.lankhorst@linux.intel.com, malattia@linux.it, martin.petersen@oracle.com, maz@kernel.org, mcoquelin.stm32@gmail.com, mgross@linux.intel.com, minchan@kernel.org, mingo@redhat.com, mripard@kernel.org, ngupta@vflare.org, pablo@netfilter.org, peterz@infradead.org, pmladek@suse.com, qiuxu.zhuo@intel.com, quic_akhilpo@quicinc.com, richard@nod.at, robdclark@gmail.com, rostedt@goodmis.org, rric@kernel.org, ruanjinjie@huawei.com, sakari.ailus@linux.intel.com, sashal@kernel.org, sean@poorly.run, senozhatsky@chromium.org, shuah@kernel.org, snitzer@redhat.com, tglx@linutronix.de, tipc-discussion@lists.sourceforge.net, tony.luck@intel.com, torvalds@linux-foundation.org, tytso@mit.edu, tzimmermann@suse.de, wens@csie.org, willy@infradead.org, x86@kernel.org, ying.xue@windriver.com, yoshfuji@linux-ipv6.org Cc: From: Date: Fri, 17 Oct 2025 10:16:14 +0200 In-Reply-To: <20251008152946.29285-10-farbere@amazon.com> Message-ID: <2025101714-woozy-dolly-87b8@gregkh> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit X-stable: commit X-Patchwork-Hint: ignore X-Rspam-User: X-Rspamd-Queue-Id: 7D1324000E X-Rspamd-Server: rspam03 X-Stat-Signature: nxcmik95u5d4y5ksk5zfki69sirw8j99 X-HE-Tag: 1760688981-923953 X-HE-Meta: U2FsdGVkX1/NoZH7POjHEra1nLl75Rpcs4D5PwVKl6STru9UomOwHiFY8LcbLmcO6ozwrUsLsS8yZu8h5aCEfWQFbLWy1Eiar+Jb+TDIp8LOXl5yirGRZ/vsno80xsYlo7/IejE9Kg70AXUd5k2EvAUsOnZxDkcp4H08GwR6atc73RIBWcHtDprvmff/X7Q8Bq5sOHM/4HhC2syXlr9Nc3CH35N4BVLoNbSvkrtwVRhIfo40ACUPOjGiCGcwg0SE84/NERAApWjeSfrTyevvGl0TR/NibeZdnEsaziE4sYHZWCE7YMrwsfBkE3Qko+Tu+qo/QEApvoh65aEV4oQvmMS203Jnoy2kchtcZffbZGqPYcIWl7mVNMQ+B36luUG27qZlTOKP7h9odc4uisGzHyfBv0a8UcnLQWraQRy7u5ELTUoWShxFe5ZuzoqzmiZ5U79+/fDE6VdhKyg1EJczTXbOiPah2NDR8G/AMQQRIdkXe1qqZF2kJQ8jRO0kc540raeleOxNehKcc2BrHU9AeB/+L2eDHJJtr9wGAf+kdyyqIHjAQKctonCTR7UUuUkVlCyQgfPCIvIEChapKnDZoh3oZEuSNNZt4+ipyoSDfSzb4CGu+aZI73Hv6twWaaSUtV5xNkEmu11XcXQ6EfGJnH8NE0Ikh44GQafublmBe7kZyrmSzNIx7QsHfDthy9z7S3cjpj5YQDW9ikMdLROE3A6XkDptyIo0yCYJMY9Nze/GLgov/q+hBAUelpAUM93UASHR+JK1uzSWx2cxzMc/mK4rqZexicW+ujSsGh83uW1lQYMZ6UdeWMSUWQ1Bwqoxx+FTa5KOgyarImyXbjvn12kF88QkrBZT428dvjFW8fp34AU+HjOKx7xYBTEjWDxCTmufYBQDcQhETxDZrko3GEMV/VLuXwisxzcfIH9zf1J2rxXilrVP5xqnWFJumDKXZIizbVuWL4eBVX2OQWg dIP2qXfL rsuLinhpyQYYEW0l6zynWKn+2HJDAgVuL/pqefJp8Z0eIodZ+W7hMYA7i7PdvRMkBpi6Jdv2j6yvIvYTq5UE+y4V8WTGQMnvUYD9ae1LhWXZENJurAXvcQHXRBZErH5qxoZNdX3rm8Xl3KTz4nacWkVy+9w== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: This is a note to let you know that I've just added the patch titled minmax: don't use max() in situations that want a C constant expression to the 5.15-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: minmax-don-t-use-max-in-situations-that-want-a-c-constant-expression.patch and it can be found in the queue-5.15 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let know about it. >From prvs=36971892a=farbere@amazon.com Wed Oct 8 17:32:28 2025 From: Eliav Farber Date: Wed, 8 Oct 2025 15:29:34 +0000 Subject: minmax: don't use max() in situations that want a C constant expression To: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Cc: Linus Torvalds , David Laight , Lorenzo Stoakes Message-ID: <20251008152946.29285-10-farbere@amazon.com> From: Linus Torvalds [ Upstream commit cb04e8b1d2f24c4c2c92f7b7529031fc35a16fed ] We only had a couple of array[] declarations, and changing them to just use 'MAX()' instead of 'max()' fixes the issue. This will allow us to simplify our min/max macros enormously, since they can now unconditionally use temporary variables to avoid using the argument values multiple times. Cc: David Laight Cc: Lorenzo Stoakes Signed-off-by: Linus Torvalds Signed-off-by: Eliav Farber Signed-off-by: Greg Kroah-Hartman --- drivers/input/touchscreen/cyttsp4_core.c | 2 +- drivers/irqchip/irq-sun6i-r.c | 2 +- drivers/md/dm-integrity.c | 2 +- fs/btrfs/tree-checker.c | 2 +- lib/vsprintf.c | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) --- a/drivers/input/touchscreen/cyttsp4_core.c +++ b/drivers/input/touchscreen/cyttsp4_core.c @@ -871,7 +871,7 @@ static void cyttsp4_get_mt_touches(struc struct cyttsp4_touch tch; int sig; int i, j, t = 0; - int ids[max(CY_TMA1036_MAX_TCH, CY_TMA4XX_MAX_TCH)]; + int ids[MAX(CY_TMA1036_MAX_TCH, CY_TMA4XX_MAX_TCH)]; memset(ids, 0, si->si_ofs.tch_abs[CY_TCH_T].max * sizeof(int)); for (i = 0; i < num_cur_tch; i++) { --- a/drivers/irqchip/irq-sun6i-r.c +++ b/drivers/irqchip/irq-sun6i-r.c @@ -268,7 +268,7 @@ static const struct irq_domain_ops sun6i static int sun6i_r_intc_suspend(void) { - u32 buf[BITS_TO_U32(max(SUN6I_NR_TOP_LEVEL_IRQS, SUN6I_NR_MUX_BITS))]; + u32 buf[BITS_TO_U32(MAX(SUN6I_NR_TOP_LEVEL_IRQS, SUN6I_NR_MUX_BITS))]; int i; /* Wake IRQs are enabled during system sleep and shutdown. */ --- a/drivers/md/dm-integrity.c +++ b/drivers/md/dm-integrity.c @@ -1705,7 +1705,7 @@ static void integrity_metadata(struct wo struct bio *bio = dm_bio_from_per_bio_data(dio, sizeof(struct dm_integrity_io)); char *checksums; unsigned extra_space = unlikely(digest_size > ic->tag_size) ? digest_size - ic->tag_size : 0; - char checksums_onstack[max((size_t)HASH_MAX_DIGESTSIZE, MAX_TAG_SIZE)]; + char checksums_onstack[MAX(HASH_MAX_DIGESTSIZE, MAX_TAG_SIZE)]; sector_t sector; unsigned sectors_to_process; --- a/fs/btrfs/tree-checker.c +++ b/fs/btrfs/tree-checker.c @@ -608,7 +608,7 @@ static int check_dir_item(struct extent_ */ if (key->type == BTRFS_DIR_ITEM_KEY || key->type == BTRFS_XATTR_ITEM_KEY) { - char namebuf[max(BTRFS_NAME_LEN, XATTR_NAME_MAX)]; + char namebuf[MAX(BTRFS_NAME_LEN, XATTR_NAME_MAX)]; read_extent_buffer(leaf, namebuf, (unsigned long)(di + 1), name_len); --- a/lib/vsprintf.c +++ b/lib/vsprintf.c @@ -1100,7 +1100,7 @@ char *resource_string(char *buf, char *e #define FLAG_BUF_SIZE (2 * sizeof(res->flags)) #define DECODED_BUF_SIZE sizeof("[mem - 64bit pref window disabled]") #define RAW_BUF_SIZE sizeof("[mem - flags 0x]") - char sym[max(2*RSRC_BUF_SIZE + DECODED_BUF_SIZE, + char sym[MAX(2*RSRC_BUF_SIZE + DECODED_BUF_SIZE, 2*RSRC_BUF_SIZE + FLAG_BUF_SIZE + RAW_BUF_SIZE)]; char *p = sym, *pend = sym + sizeof(sym); Patches currently in stable-queue which might be from farbere@amazon.com are queue-5.15/minmax-add-a-few-more-min_t-max_t-users.patch queue-5.15/minmax-improve-macro-expansion-and-type-checking.patch queue-5.15/minmax-fix-indentation-of-__cmp_once-and-__clamp_once.patch queue-5.15/minmax.h-simplify-the-variants-of-clamp.patch queue-5.15/minmax-add-in_range-macro.patch queue-5.15/minmax.h-move-all-the-clamp-definitions-after-the-min-max-ones.patch queue-5.15/minmax-don-t-use-max-in-situations-that-want-a-c-constant-expression.patch queue-5.15/minmax.h-remove-some-defines-that-are-only-expanded-once.patch queue-5.15/minmax.h-use-build_bug_on_msg-for-the-lo-hi-test-in-clamp.patch queue-5.15/minmax-simplify-min-max-clamp-implementation.patch queue-5.15/minmax-deduplicate-__unconst_integer_typeof.patch queue-5.15/minmax-simplify-and-clarify-min_t-max_t-implementation.patch queue-5.15/minmax.h-add-whitespace-around-operators-and-after-commas.patch queue-5.15/minmax-avoid-overly-complicated-constant-expressions-in-vm-code.patch queue-5.15/minmax-make-generic-min-and-max-macros-available-everywhere.patch queue-5.15/minmax-fix-up-min3-and-max3-too.patch queue-5.15/minmax.h-reduce-the-define-expansion-of-min-max-and-clamp.patch queue-5.15/minmax-introduce-min-max-_array.patch queue-5.15/minmax.h-update-some-comments.patch