From nobody Tue Dec 2 02:32:14 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 AF35C30DD3A for ; Wed, 19 Nov 2025 22:42:38 +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=1763592160; cv=none; b=DdJFW0AfhlncOAVJLVTrwifXWtTdWsK0ICCx0XcszeAgKR4WTO6GxHP7/61s1sdmi03a9g+64gd11dVpaj6BbVgePsc40A7BgWkeUh4/dBYjqYRvZP+UtJTGfGeN93eM052v2TNVv/X38vSa1bSHzQmU8Ia38HHSJmGQ0DJUjtg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763592160; c=relaxed/simple; bh=hyzVVjTSJlC1E8OKMLO7XNxgAux/QpvEyehYdPBL3s8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=hH2hrQZ3VyGgP+1X358EV0NpYnsUKIbRwnMIgYqMAFZLzFVbXHsgXjNSB5B7eR2x7ubKVeAihCkfhOTpvaRgCWK2jxp+5tf/TEBo0wA3JKRKnRCg0JGeZY1D18hvZKYp2yokkSSbJqnTKme/zeFSGB0+4kAJwEnn9YLDhWHsxqw= 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=0R/F9b6g; 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="0R/F9b6g" 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 1vLqsm-006ksS-Ji; Wed, 19 Nov 2025 23:42:36 +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=o6mVTuxrgEQ+tTQ1DsDzrfzaC0rJ6013cLt7rd7pss8=; b=0R/F9b6gZ8zRBCHuDM8ws2te7k F5g+QW1s9ajDxb4KGewCKKcI2vocoR3K1uUJeXHNqEGizT7nRiDVjYhIN0gZ7rDDMi7IiAZ13Io/V rsU6los3KsBUpjjwxfF3CIT0E1FcBqhxh0/7zP6E4sZSEUOhpvoP/KmEeml4A3GFr5lUWQ/dXhlhh tIuhGk5yb+H2/vkeryPuYyj1QFrXsmtl5Io0Trlct1cy6jI+LwclfTyx346d/odDZ80h/ZGE8wdQU RPyI4RRGNsvtGm5474tPyRkbio8qDGij7Q1Js2QS769pCyrFgrCB9DTh/t5STyFvZwiSQl1LPOgTc b2vUjCVA==; Received: from [10.9.9.74] (helo=submission03.runbox) by mailtransmit03.runbox with esmtp (Exim 4.86_2) (envelope-from ) id 1vLqsl-00006N-UM; Wed, 19 Nov 2025 23:42:36 +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 1vLqsg-00Fos6-BS; Wed, 19 Nov 2025 23:42:30 +0100 From: david.laight.linux@gmail.com To: linux-kernel@vger.kernel.org Cc: Srinivas Kandagatla , David Laight Subject: [PATCH 24/44] drivers/nvmem: use min() instead of min_t() Date: Wed, 19 Nov 2025 22:41:20 +0000 Message-Id: <20251119224140.8616-25-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 --- drivers/nvmem/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index 387c88c55259..8d6e78343054 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -359,7 +359,7 @@ static ssize_t nvmem_cell_attr_read(struct file *filp, = struct kobject *kobj, goto destroy_cell; } =20 - read_len =3D min_t(unsigned int, cell_sz - pos, count); + read_len =3D min(cell_sz - pos, count); memcpy(buf, content + pos, read_len); kfree(content); =20 --=20 2.39.5