From nobody Tue Dec 2 02:31:05 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 5CBB430149E for ; Wed, 19 Nov 2025 22:42:45 +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=1763592167; cv=none; b=P2eE4HsJWYTq1+DHXl+N0sEYd6PTNZczTAaGmhTK+pzXxNzHJ51kdtMIvw8E/tOhNAmTv2ut5D3OxXg1R8VJ5U16ijJkzhfJmZEHTTujgjg8NR4UkPx7xvu8VZv5tPjiWk5LH9X3nPsW+Oj4EhgxZvmghc0Tlz3tISRo1nokpBo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763592167; c=relaxed/simple; bh=g60Rg3Blvfh9qgL8PXDaIT0h46xfSnzee+mP4szbxzQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=bMlk+iEyYMsax5VqLfJCN2VVeD9G2rIlEdnF3hsUzQTs6vESxMh16mDkLIPiNJTi7rzw5skIKUmatW+tMgeEF8QHAIW/gbjilIfbRYku4d44uatgGrLBeopz1MJJ4Xqb7YLSvzM/6x7vLeil21pZNhkiQcViXOY5vxfsL3fjnxw= 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=E6+dxLu3; 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="E6+dxLu3" Received: from mailtransmit02.runbox ([10.9.9.162] 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 1vLqst-006ktv-84; Wed, 19 Nov 2025 23:42:43 +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=ysDW8qwXmRgKHZdg4L2eLNx73N6/MPjiQ+A1E28GvOk=; b=E6+dxLu3s+fU7AN6k9d5NzmFtR ItJMW/F8K+4swgS28GPYyUL8Ps4j3X9tbN/f0Pq+13TmwifX8+ooezHy3UlQ5qu/ZlzLycJ8G8l69 zaP9m/3UcfkiP28nG9bibQxYFqmSqS6zV9DOQvf/EEOy5LRUbIE2RccTRrgUNFx6FM37v0/Kuadp/ GUPCBL70XZASgyc3PEBW8BAIBmcHoYZP+eO3RUyezY8x0vWuYV8U86G1kX626/EIFTRjHC37zDR2T VaR/VDhKJg7tFw2vDMtwNNQ2RyckK2bNqwSEVTWosL2ze9Y7h8wpAg6JDPNGyTbWqhR6Rdkmlryfn t9h7B3dQ==; Received: from [10.9.9.74] (helo=submission03.runbox) by mailtransmit02.runbox with esmtp (Exim 4.86_2) (envelope-from ) id 1vLqss-00085Z-UH; Wed, 19 Nov 2025 23:42:43 +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 1vLqsj-00Fos6-Ea; Wed, 19 Nov 2025 23:42:33 +0100 From: david.laight.linux@gmail.com To: linux-kernel@vger.kernel.org Cc: David Laight Subject: [PATCH 31/44] block: bvec.h: use min() instead of min_t() Date: Wed, 19 Nov 2025 22:41:27 +0000 Message-Id: <20251119224140.8616-32-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 --- include/linux/bvec.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/linux/bvec.h b/include/linux/bvec.h index 3fc0efa0825b..dbef99624bd5 100644 --- a/include/linux/bvec.h +++ b/include/linux/bvec.h @@ -219,8 +219,7 @@ static inline void bvec_advance(const struct bio_vec *b= vec, bv->bv_page =3D bvec->bv_page + (bvec->bv_offset >> PAGE_SHIFT); bv->bv_offset =3D bvec->bv_offset & ~PAGE_MASK; } - bv->bv_len =3D min_t(unsigned int, PAGE_SIZE - bv->bv_offset, - bvec->bv_len - iter_all->done); + bv->bv_len =3D min(PAGE_SIZE - bv->bv_offset, bvec->bv_len - iter_all->do= ne); iter_all->done +=3D bv->bv_len; =20 if (iter_all->done =3D=3D bvec->bv_len) { --=20 2.39.5