From nobody Tue Dec 2 02:31:03 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 E346732B9A6 for ; Wed, 19 Nov 2025 22:42:56 +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=1763592179; cv=none; b=Y4+XHxpgevESoeXLOTe+RUHN5ag9GRxDZ9Yv57BmLZ3JvTbLxEoLsKKgRpeD9WDYN1WZw4y3Q1uOTS2ep2PJilSAMSsTWYtra3/gjZQeKuYUbCPPPAgcfZwOvnVEC5G7UJ4uQayTdjhn4LGBVM6VEXe725ZeQXmLSe17lf5hMiQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763592179; c=relaxed/simple; bh=RdN0Sn5XuXcEzPy3B/N2a8aHHOEz7sEBT5aYF+wTatU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Fp788Qmq4SUv9F3AuUzDGL81Sr5CaA8W/U6oAx5mTLTxhYPDiEESGFxJ65RLZByTXpeVPMjzCFwRLt17x6Pp01AYYi4FVXrsfXoNTMqDQpd+FMsUluiyp+27fXUcmWqrXku5kdcB+VOs0exrPgcV67g4L1ebFGHPZrCI0ITo9uQ= 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=6trSvTPr; 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="6trSvTPr" 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 1vLqt4-006kyq-Kn; Wed, 19 Nov 2025 23:42:54 +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=BSz/fMMZWekU3UOYf2YMiRRmSk70/lINvYIBRF8e4UI=; b=6trSvTPrR9TLIYpb3iYBdppyha WGIzq5ysNkFIWYc/BDzOaKfbNyE+F+7jG92/HcjuCGJt4fZbzHsNaPlYlnFvHr9BOff+3/yuXxqWa JS5YJ5xYxo63tZzpZf6vO7gxrdDa9Fo8fd8pV+H9YFWPUlN8crOBkwTZf3AmB+4LL8w+ou28qDqrw VMkbPpdw0yYTAtWv/+mNSzFnZ/bSz40I/nsozbru2igARtDlZE42HkRGrhHZmTQLWqy37jrwF9Rdo 8zNe5WZW356E+6uRZifavZ5/X0qaTMzNZcckp/yxg9gyqAsIT6Hhhs7GyyLTGCTbZ7dTaHpcsFDRq 6W1F7/bg==; Received: from [10.9.9.74] (helo=submission03.runbox) by mailtransmit03.runbox with esmtp (Exim 4.86_2) (envelope-from ) id 1vLqt4-0000EL-9k; Wed, 19 Nov 2025 23:42:54 +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 1vLqsi-00Fos6-E8; Wed, 19 Nov 2025 23:42:32 +0100 From: david.laight.linux@gmail.com To: linux-kernel@vger.kernel.org Cc: Juergen Gross , Stefano Stabellini , David Laight Subject: [PATCH 29/44] drivers/xen: use min() instead of min_t() Date: Wed, 19 Nov 2025 22:41:25 +0000 Message-Id: <20251119224140.8616-30-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 Reviewed-by: Juergen Gross --- drivers/xen/grant-table.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c index 478d2ad725ac..3e76e33f6e08 100644 --- a/drivers/xen/grant-table.c +++ b/drivers/xen/grant-table.c @@ -1204,7 +1204,7 @@ void gnttab_foreach_grant_in_range(struct page *page, unsigned int glen; unsigned long xen_pfn; =20 - len =3D min_t(unsigned int, PAGE_SIZE - offset, len); + len =3D min(PAGE_SIZE - offset, len); goffset =3D xen_offset_in_page(offset); =20 xen_pfn =3D page_to_xen_pfn(page) + XEN_PFN_DOWN(offset); --=20 2.39.5