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 lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B2DEBCCD1A2 for ; Fri, 17 Oct 2025 09:11:07 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [127.0.0.1]) by lists.ozlabs.org (Postfix) with ESMTP id 4cnzZf1z4cz3cYL; Fri, 17 Oct 2025 20:11:06 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; arc=none smtp.remote-ip=52.34.181.151 ARC-Seal: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1760692266; cv=none; b=oOkzprXvzaiho0KAjmq11tVIrH+k9W4Qp/ihDPdGgybwzA6TNGI/6KcoQxhz/XIfvBrGCwMRVAJxMgUKy5fuRw3MknFnTEkLwRmlaJIStem/82EyKDpLwfGlp4FUjqRJAvmpo08cqP3rwNUm4EHJiVNk97InCLO2hML0i0asjgfncT5Mq8GzznXamtLzsAcjRyUixIYOfCKj4OxSHVqxrKjbrfhNcX0GzCIId8dtwzR1xKqp73Oisvnl6OGjVCc8jbxX21IUK7LP9LLU2o/J+qP2DpdbhUlcno/USzoyo+7+peyIxh2gDRSHqlqze79faP138u6i0LXPZjwnIQS2zQ== ARC-Message-Signature: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1760692266; c=relaxed/relaxed; bh=7swfVbslESxQg74V4Pet/sTVI7N58Kfpf4qGaJIy9fE=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=LccO5gSFpck8n7075S8fCoWSeb+soGWNLbAeuojywlRyJRJpwb6IGH1g7T1z7g85LOhXZ+LsmswJsPs33Oq+mnWG8jQv0msOUccuF92SJviH1hTvcSPR0xlMuE2oKsDYJpceAn712hEmPC1GT/r2+utG7UEO9U7NF8DIFnwjutN5Ofix1zRdRZJR9BkfC0SOjZ+BVFNeEmAfD3ojy4os/6Ybn1aJVLIfL/S8RT8TsYR+aqfHrGowkiGuNWd2Eb8oPcZ0qWW6rDEmQmoEcRjzrq5MiPi7ek0EAGV+O5JVxn5r8cknE+PrjMsI1mPKSo+u+P/qOZuihpXmvt0YTZa83g== ARC-Authentication-Results: i=1; lists.ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.com; dkim=pass (2048-bit key; unprotected) header.d=amazon.com header.i=@amazon.com header.a=rsa-sha256 header.s=amazoncorp2 header.b=U/G5cJz0; dkim-atps=neutral; spf=pass (client-ip=52.34.181.151; helo=pdx-out-007.esa.us-west-2.outbound.mail-perimeter.amazon.com; envelope-from=prvs=378230090=farbere@amazon.com; receiver=lists.ozlabs.org) smtp.mailfrom=amazon.com Authentication-Results: lists.ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=amazon.com header.i=@amazon.com header.a=rsa-sha256 header.s=amazoncorp2 header.b=U/G5cJz0; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=amazon.com (client-ip=52.34.181.151; helo=pdx-out-007.esa.us-west-2.outbound.mail-perimeter.amazon.com; envelope-from=prvs=378230090=farbere@amazon.com; receiver=lists.ozlabs.org) Received: from pdx-out-007.esa.us-west-2.outbound.mail-perimeter.amazon.com (pdx-out-007.esa.us-west-2.outbound.mail-perimeter.amazon.com [52.34.181.151]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4cnzZd2rX1z2xcB for ; Fri, 17 Oct 2025 20:11:05 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazoncorp2; t=1760692265; x=1792228265; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=7swfVbslESxQg74V4Pet/sTVI7N58Kfpf4qGaJIy9fE=; b=U/G5cJz0f22JmfCBICC8kvGZV/1h89p5ScbRxRsPqmapEMVypQan2LFM jl61tYOtZW799dH/wkXtGIiVQSvKiMWacC5zZaBBAXlyDvHh8rRIveQSP ibVW16NflWgZGyeiR7wHjQBIrO+xr+F61eFXa1CXv1Ej8yWB/JQ9Aq7OO JU3FcX895Q4UNoXAc4e721rXOxDOUI3bUCGE1J9utaacYYUKgfvs1ZNxs 4+4mbTmGRZpZFKIrQyAulqBxndJmKp1drirw/g8ZmxVH31oNb6UlpjNu7 jDfGPMuVQMoHfv+DOxspISssoyHQ9gyeDD2+IVzHGXwXKx2be1fn3MCoS Q==; X-CSE-ConnectionGUID: Q5MoDO3uRIu7RKOhofxO9w== X-CSE-MsgGUID: 0ZVv2KswS5q2HkEJPsaUgg== X-IronPort-AV: E=Sophos;i="6.18,263,1751241600"; d="scan'208";a="5073427" Received: from ip-10-5-0-115.us-west-2.compute.internal (HELO smtpout.naws.us-west-2.prod.farcaster.email.amazon.dev) ([10.5.0.115]) by internal-pdx-out-007.esa.us-west-2.outbound.mail-perimeter.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Oct 2025 09:11:03 +0000 Received: from EX19MTAUWA002.ant.amazon.com [205.251.233.234:31840] by smtpin.naws.us-west-2.prod.farcaster.email.amazon.dev [10.0.18.50:2525] with esmtp (Farcaster) id 8605e8df-aafc-4858-9c90-42564ba4b59d; Fri, 17 Oct 2025 09:11:02 +0000 (UTC) X-Farcaster-Flow-ID: 8605e8df-aafc-4858-9c90-42564ba4b59d Received: from EX19D001UWA001.ant.amazon.com (10.13.138.214) by EX19MTAUWA002.ant.amazon.com (10.250.64.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.2562.20; Fri, 17 Oct 2025 09:11:02 +0000 Received: from dev-dsk-farbere-1a-46ecabed.eu-west-1.amazon.com (172.19.116.181) by EX19D001UWA001.ant.amazon.com (10.13.138.214) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.2562.20; Fri, 17 Oct 2025 09:10:47 +0000 From: Eliav Farber To: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , CC: Linus Torvalds , David Laight , Lorenzo Stoakes Subject: [PATCH v2 17/27 5.10.y] minmax: don't use max() in situations that want a C constant expression Date: Fri, 17 Oct 2025 09:05:09 +0000 Message-ID: <20251017090519.46992-18-farbere@amazon.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20251017090519.46992-1-farbere@amazon.com> References: <20251017090519.46992-1-farbere@amazon.com> X-Mailing-List: linux-erofs@lists.ozlabs.org List-Id: List-Help: List-Owner: List-Post: List-Subscribe: , , List-Unsubscribe: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.19.116.181] X-ClientProxiedBy: EX19D038UWC002.ant.amazon.com (10.13.139.238) To EX19D001UWA001.ant.amazon.com (10.13.138.214) 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/md/dm-integrity.c | 4 ++-- fs/btrfs/tree-checker.c | 2 +- lib/vsprintf.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/input/touchscreen/cyttsp4_core.c b/drivers/input/touchscreen/cyttsp4_core.c index 02a73d9a4def..c10140c9aafa 100644 --- a/drivers/input/touchscreen/cyttsp4_core.c +++ b/drivers/input/touchscreen/cyttsp4_core.c @@ -857,7 +857,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/md/dm-integrity.c b/drivers/md/dm-integrity.c index 7fa3bf74747d..917ba18be77f 100644 --- a/drivers/md/dm-integrity.c +++ b/drivers/md/dm-integrity.c @@ -1600,7 +1600,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; @@ -1882,7 +1882,7 @@ static bool __journal_read_write(struct dm_integrity_io *dio, struct bio *bio, } while (++s < ic->sectors_per_block); #ifdef INTERNAL_VERIFY if (ic->internal_hash) { - char checksums_onstack[max((size_t)HASH_MAX_DIGESTSIZE, MAX_TAG_SIZE)]; + char checksums_onstack[MAX(HASH_MAX_DIGESTSIZE, MAX_TAG_SIZE)]; integrity_sector_checksum(ic, logical_sector, mem + bv.bv_offset, checksums_onstack); if (unlikely(memcmp(checksums_onstack, journal_entry_tag(ic, je), ic->tag_size))) { diff --git a/fs/btrfs/tree-checker.c b/fs/btrfs/tree-checker.c index c28bb37688c6..fd4768c5e439 100644 --- a/fs/btrfs/tree-checker.c +++ b/fs/btrfs/tree-checker.c @@ -587,7 +587,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 b08b8ee1bbc0..90372391ce90 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c @@ -1078,7 +1078,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