From nobody Tue Dec 2 02:32:15 2025 Received: from mailtransmit05.runbox.com (mailtransmit05.runbox.com [185.226.149.38]) (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 E85B13321C2 for ; Wed, 19 Nov 2025 22:42:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.226.149.38 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763592173; cv=none; b=QQLUGQ2UJ6UGqRiK20030kSPwmJUtrhL8hpiQIh+reEls4G1jcNZfS6xSELHPL821BnrUEn1WKeb0n4SWFwEsnpJ39F7Uvjpzcy/QTcSxorsqsQf5X0b0iMAiRVTjdybsDMzAcS7B12jmIBTADuvjzf3v/rGgY9e+WfKPWVjmvA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763592173; c=relaxed/simple; bh=FymJZ5+v7P8+4p8PtMyelf8jZqtTo+9TVYZJVGvw6Fg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Li1238Ap0zzG8gyT+J3cp05vFqxEz0YRyvCtX/OTN347eF50RELz0OkPftFgZoEztmg0JndBcLa76obSzydEEF1BqMRLgU59aaM+2bYoEsJYD7NdqMUFZovrh/2tDsAujT8IfFC3cALAA3eWd860NNzHXJYt7126UQJ8Wxv0ack= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=runbox.com; dkim=pass (2048-bit key) header.d=runbox.com header.i=@runbox.com header.b=xpi6Vhrh; arc=none smtp.client-ip=185.226.149.38 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=runbox.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=runbox.com header.i=@runbox.com header.b="xpi6Vhrh" Received: from mailtransmit03.runbox ([10.9.9.163] helo=aibo.runbox.com) by mailtransmit05.runbox.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1vLqsz-006kwz-1T for linux-kernel@vger.kernel.org; Wed, 19 Nov 2025 23:42:49 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=runbox.com; s=selector1; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To :Message-Id:Date:Subject:Cc:To:From; bh=KkEK9Y0pxeOlQTzI407LdutVRUa9UxuhbhibczYgQpE=; b=xpi6VhrhMwu1p6NyvHH8Sx4IJN 3A8cfOPPI1rjsN9/LPgZxz6eHRI3TEzGP9pRRfEgtTpkYRfqrQiSA4vhR2zPanYsOPKZ5tWUzR8nE hcvCfdveW2UIrlClMANItdb3fAc2Jhljf5+V3P8mKZT4je4GvWp51JDODAIpOI6yDSct2N26WyTdU jBma6pnrji9nhVvTz6HuqVx+ODl4mIXogH5cmBdP/eJBp69Gj66/jWLhUzLd7n5XidoeVczHJHTM4 e8NDYvSCspeOuJtPWR4BOXsEjZyEsnNF71z95kyeDJx2Rd0ZZYct7YuHTe/rjsOZU5/Zfx1lTz8FO 1NWnYSMg==; Received: from [10.9.9.74] (helo=submission03.runbox) by mailtransmit03.runbox with esmtp (Exim 4.86_2) (envelope-from ) id 1vLqsy-0000Db-Mi; Wed, 19 Nov 2025 23:42:48 +0100 Received: by submission03.runbox with esmtpsa [Authenticated ID (1493616)] (TLS1.2:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.93) id 1vLqsl-00Fos6-K1; Wed, 19 Nov 2025 23:42:35 +0100 From: david.laight.linux@gmail.com To: linux-kernel@vger.kernel.org Cc: Andrew Morton , David Laight Subject: [PATCH 36/44] lib/bucket_locks: use min() instead of min_t() Date: Wed, 19 Nov 2025 22:41:32 +0000 Message-Id: <20251119224140.8616-37-david.laight.linux@gmail.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20251119224140.8616-1-david.laight.linux@gmail.com> References: <20251119224140.8616-1-david.laight.linux@gmail.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 Content-Type: text/plain; charset="utf-8" From: David Laight min_t(unsigned int, a, b) casts an 'unsigned long' to 'unsigned int'. Use min(a, b) instead as it promotes any 'unsigned int' to 'unsigned long' and so cannot discard significant bits. In this case the 'unsigned long' value is small enough that the result is ok. Detected by an extra check added to min_t(). Signed-off-by: David Laight --- lib/bucket_locks.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bucket_locks.c b/lib/bucket_locks.c index 64b92e1dbace..6bad65501f2d 100644 --- a/lib/bucket_locks.c +++ b/lib/bucket_locks.c @@ -25,7 +25,7 @@ int __alloc_bucket_spinlocks(spinlock_t **locks, unsigned= int *locks_mask, =20 if (cpu_mult) { nr_pcpus =3D min_t(unsigned int, nr_pcpus, 64UL); - size =3D min_t(unsigned int, nr_pcpus * cpu_mult, max_size); + size =3D min(nr_pcpus * cpu_mult, max_size); } else { size =3D max_size; } --=20 2.39.5