From nobody Wed Dec 17 19:38:04 2025 Received: from fra-out-005.esa.eu-central-1.outbound.mail-perimeter.amazon.com (fra-out-005.esa.eu-central-1.outbound.mail-perimeter.amazon.com [63.176.194.123]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F0329175BF; Fri, 3 Oct 2025 13:05:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=63.176.194.123 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759496710; cv=none; b=P7mcvhJjG6jop5/Gh63Aedmhcnw2WCO1MXthyjp3VFO3LmwIKA/7FvN0wEYl5JM662MYbZgPfDJ3omVuMegAm6wKCIUZ670u4Q9uYKHBJ0AWDRn7xoVFpp3V2dvfVXOaA4PwJNt99E6iIO1qVpsiutKYlRbwU6U1OMTD3SBgrWU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759496710; c=relaxed/simple; bh=JzQvrzm+cSwkI78ne1th+Af5OP6qKK4PGWTMyb6vkD0=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=T5AAI0yovTJCQnaGK1JfnKSO3hYGrs0PNke21cmvMEniH1fWiG4eEDOYBRVPgjez+q2EOlUN3i+Rn+w+vas7YczCkK0f7aE5/0Prz3jlsyNxztHwoJpVD+Sm0h91vj7JTDfKZQm5uk7HQ4ezvnYLEAjH4PpaDPbljVFtlCBqREg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.com; spf=pass smtp.mailfrom=amazon.com; dkim=pass (2048-bit key) header.d=amazon.com header.i=@amazon.com header.b=EApKYIPW; arc=none smtp.client-ip=63.176.194.123 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=amazon.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=amazon.com header.i=@amazon.com header.b="EApKYIPW" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazoncorp2; t=1759496708; x=1791032708; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Un1JE7toeI83ffXaasUfHmeV127z9Znvwu1ZeiNJbjk=; b=EApKYIPW7OOJWjQtRdyx3tiLBJhCB+VxWlqdY8FXbVfS+zSr0fJkoeOU sXdwUTlr/121MQNVISPuq2SIcT4/JKc1GJ6yupEhUm/BxCfQGecMXoMI/ 2QBB1z4Djmu0jYHt8mehFyNUzuzkvKBXU7QALrI4btB5FF2iM58vqT44Z W0opy2zuOn2kPxf34NjtfeBRYfb4ztkW7iZIKV/l9WZ0TZfFX4PWImhkw et4JOk/84PVyZxx4y5A9JNN9sWrXo3wRxeetYe1hd05PsPr6wBayHkOUh y5Z9vcliXCHa6QCim5xsdIuG7CWpm6vL/NFl/rOvOi2SmzKRxoXefsorD Q==; X-CSE-ConnectionGUID: 6R4CGBMrRRGA1NnFWvKwdg== X-CSE-MsgGUID: bMMiRLiJRyytxeFDcKdX/w== X-IronPort-AV: E=Sophos;i="6.18,312,1751241600"; d="scan'208";a="3063483" Received: from ip-10-6-3-216.eu-central-1.compute.internal (HELO smtpout.naws.eu-central-1.prod.farcaster.email.amazon.dev) ([10.6.3.216]) by internal-fra-out-005.esa.eu-central-1.outbound.mail-perimeter.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Oct 2025 13:04:55 +0000 Received: from EX19MTAEUB002.ant.amazon.com [54.240.197.232:25758] by smtpin.naws.eu-central-1.prod.farcaster.email.amazon.dev [10.0.4.140:2525] with esmtp (Farcaster) id 41f1e6ba-7354-4550-b09f-a78bf412bfba; Fri, 3 Oct 2025 13:04:55 +0000 (UTC) X-Farcaster-Flow-ID: 41f1e6ba-7354-4550-b09f-a78bf412bfba Received: from EX19D018EUA004.ant.amazon.com (10.252.50.85) by EX19MTAEUB002.ant.amazon.com (10.252.51.59) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.2562.20; Fri, 3 Oct 2025 13:04:52 +0000 Received: from dev-dsk-farbere-1a-46ecabed.eu-west-1.amazon.com (172.19.116.181) by EX19D018EUA004.ant.amazon.com (10.252.50.85) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.2562.20; Fri, 3 Oct 2025 13:04:26 +0000 From: Eliav Farber To: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , CC: Linus Torvalds , David Laight , Lorenzo Stoakes Subject: [PATCH v2 09/19 5.15.y] minmax: don't use max() in situations that want a C constant expression Date: Fri, 3 Oct 2025 12:59:56 +0000 Message-ID: <20251003130006.41681-10-farbere@amazon.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20251003130006.41681-1-farbere@amazon.com> References: <20251003130006.41681-1-farbere@amazon.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: EX19D040UWB003.ant.amazon.com (10.13.138.8) To EX19D018EUA004.ant.amazon.com (10.252.50.85) Content-Type: text/plain; charset="utf-8" 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 --- 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/touch= screen/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_da= ta *md, int num_cur_tch) struct cyttsp4_touch tch; int sig; int i, j, t =3D 0; - int ids[max(CY_TMA1036_MAX_TCH, CY_TMA4XX_MAX_TCH)]; + int ids[MAX(CY_TMA1036_MAX_TCH, CY_TMA4XX_MAX_TCH)]; =20 memset(ids, 0, si->si_ofs.tch_abs[CY_TCH_T].max * sizeof(int)); for (i =3D 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 =3D { =20 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; =20 /* 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 =3D dm_bio_from_per_bio_data(dio, sizeof(struct dm_integ= rity_io)); char *checksums; unsigned extra_space =3D unlikely(digest_size > ic->tag_size) ? digest_s= ize - 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; =20 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 =3D=3D BTRFS_DIR_ITEM_KEY || key->type =3D=3D BTRFS_XATTR_ITEM_KEY) { - char namebuf[max(BTRFS_NAME_LEN, XATTR_NAME_MAX)]; + char namebuf[MAX(BTRFS_NAME_LEN, XATTR_NAME_MAX)]; =20 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 re= source *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)]; =20 char *p =3D sym, *pend =3D sym + sizeof(sym); --=20 2.47.3