[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251002204733.35652-11-farbere@amazon.com>
Date: Thu, 2 Oct 2025 20:47:24 +0000
From: Eliav Farber <farbere@...zon.com>
To: <gregkh@...uxfoundation.org>, <jdike@...toit.com>, <richard@....at>,
<anton.ivanov@...bridgegreys.com>, <dave.hansen@...ux.intel.com>,
<luto@...nel.org>, <peterz@...radead.org>, <tglx@...utronix.de>,
<mingo@...hat.com>, <bp@...en8.de>, <x86@...nel.org>, <hpa@...or.com>,
<tony.luck@...el.com>, <qiuxu.zhuo@...el.com>, <james.morse@....com>,
<rric@...nel.org>, <airlied@...ux.ie>, <daniel@...ll.ch>,
<maarten.lankhorst@...ux.intel.com>, <mripard@...nel.org>,
<tzimmermann@...e.de>, <robdclark@...il.com>, <sean@...rly.run>,
<jdelvare@...e.com>, <linux@...ck-us.net>, <linus.walleij@...aro.org>,
<dmitry.torokhov@...il.com>, <maz@...nel.org>, <wens@...e.org>,
<jernej.skrabec@...il.com>, <agk@...hat.com>, <snitzer@...hat.com>,
<dm-devel@...hat.com>, <davem@...emloft.net>, <kuba@...nel.org>,
<mcoquelin.stm32@...il.com>, <krzysztof.kozlowski@...onical.com>,
<malattia@...ux.it>, <hdegoede@...hat.com>, <mgross@...ux.intel.com>,
<jejb@...ux.ibm.com>, <martin.petersen@...cle.com>,
<sakari.ailus@...ux.intel.com>, <clm@...com>, <josef@...icpanda.com>,
<dsterba@...e.com>, <jack@...e.com>, <tytso@....edu>,
<adilger.kernel@...ger.ca>, <dushistov@...l.ru>,
<luc.vanoostenryck@...il.com>, <rostedt@...dmis.org>, <pmladek@...e.com>,
<senozhatsky@...omium.org>, <andriy.shevchenko@...ux.intel.com>,
<linux@...musvillemoes.dk>, <minchan@...nel.org>, <ngupta@...are.org>,
<akpm@...ux-foundation.org>, <yoshfuji@...ux-ipv6.org>, <dsahern@...nel.org>,
<pablo@...filter.org>, <kadlec@...filter.org>, <fw@...len.de>,
<jmaloy@...hat.com>, <ying.xue@...driver.com>, <shuah@...nel.org>,
<willy@...radead.org>, <farbere@...zon.com>, <sashal@...nel.org>,
<quic_akhilpo@...cinc.com>, <ruanjinjie@...wei.com>,
<David.Laight@...LAB.COM>, <herve.codina@...tlin.com>,
<linux-arm-kernel@...ts.infradead.org>, <linux-kernel@...r.kernel.org>,
<linux-um@...ts.infradead.org>, <linux-edac@...r.kernel.org>,
<amd-gfx@...ts.freedesktop.org>, <dri-devel@...ts.freedesktop.org>,
<linux-arm-msm@...r.kernel.org>, <freedreno@...ts.freedesktop.org>,
<linux-hwmon@...r.kernel.org>, <linux-input@...r.kernel.org>,
<linux-sunxi@...ts.linux.dev>, <linux-media@...r.kernel.org>,
<netdev@...r.kernel.org>, <linux-stm32@...md-mailman.stormreply.com>,
<platform-driver-x86@...r.kernel.org>, <linux-scsi@...r.kernel.org>,
<linux-staging@...ts.linux.dev>, <linux-btrfs@...r.kernel.org>,
<linux-ext4@...r.kernel.org>, <linux-sparse@...r.kernel.org>,
<linux-mm@...ck.org>, <netfilter-devel@...r.kernel.org>,
<coreteam@...filter.org>, <tipc-discussion@...ts.sourceforge.net>,
<linux-kselftest@...r.kernel.org>, <stable@...r.kernel.org>
CC: Linus Torvalds <torvalds@...ux-foundation.org>, David Laight
<David.Laight@...lab.com>, Lorenzo Stoakes <lorenzo.stoakes@...cle.com>
Subject: [PATCH 10/19 5.15.y] minmax: don't use max() in situations that want a C constant expression
From: Linus Torvalds <torvalds@...ux-foundation.org>
[ 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 <David.Laight@...lab.com>
Cc: Lorenzo Stoakes <lorenzo.stoakes@...cle.com>
Signed-off-by: Linus Torvalds <torvalds@...ux-foundation.org>
Signed-off-by: Eliav Farber <farbere@...zon.com>
---
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(-)
diff --git a/drivers/input/touchscreen/cyttsp4_core.c b/drivers/input/touchscreen/cyttsp4_core.c
index dccbcb942fe5..936d69da3bda 100644
--- a/drivers/input/touchscreen/cyttsp4_core.c
+++ b/drivers/input/touchscreen/cyttsp4_core.c
@@ -871,7 +871,7 @@ static void cyttsp4_get_mt_touches(struct cyttsp4_mt_data *md, int num_cur_tch)
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++) {
diff --git a/drivers/irqchip/irq-sun6i-r.c b/drivers/irqchip/irq-sun6i-r.c
index 4cd3e533740b..74b1bd331425 100644
--- 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_r_intc_domain_ops = {
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. */
diff --git a/drivers/md/dm-integrity.c b/drivers/md/dm-integrity.c
index 8e2b00536c3e..9e2bbfe328f0 100644
--- a/drivers/md/dm-integrity.c
+++ b/drivers/md/dm-integrity.c
@@ -1705,7 +1705,7 @@ static void integrity_metadata(struct work_struct *w)
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;
diff --git a/fs/btrfs/tree-checker.c b/fs/btrfs/tree-checker.c
index 51e04efe3e20..8f96ddaceb9a 100644
--- a/fs/btrfs/tree-checker.c
+++ b/fs/btrfs/tree-checker.c
@@ -608,7 +608,7 @@ static int check_dir_item(struct extent_buffer *leaf,
*/
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);
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index d86abdc77c26..e46eb93c115d 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -1100,7 +1100,7 @@ char *resource_string(char *buf, char *end, struct resource *res,
#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);
--
2.47.3
Powered by blists - more mailing lists