Skip to content

Commit 150215b

Browse files
David Laightjgross1
authored andcommitted
drivers/xen: use min() instead of min_t()
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 <david.laight.linux@gmail.com> Reviewed-by: Juergen Gross <jgross@suse.com> Message-ID: <20251119224140.8616-30-david.laight.linux@gmail.com> Signed-off-by: Juergen Gross <jgross@suse.com>
1 parent a73d4a0 commit 150215b

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/xen/grant-table.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1204,7 +1204,7 @@ void gnttab_foreach_grant_in_range(struct page *page,
12041204
unsigned int glen;
12051205
unsigned long xen_pfn;
12061206

1207-
len = min_t(unsigned int, PAGE_SIZE - offset, len);
1207+
len = min(PAGE_SIZE - offset, len);
12081208
goffset = xen_offset_in_page(offset);
12091209

12101210
xen_pfn = page_to_xen_pfn(page) + XEN_PFN_DOWN(offset);

0 commit comments

Comments
 (0)