David Laight
0f5bb0cfb0
fs: use min() or umin() 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.
A couple of places need umin() because of loops like:
nfolios = DIV_ROUND_UP(ret + start, PAGE_SIZE);
for (i = 0; i < nfolios; i++) {
struct folio *folio = page_folio(pages[i]);
...
unsigned int len = umin(ret, PAGE_SIZE - start);
...
ret -= len;
...
}
where the compiler doesn't track things well enough to know that
'ret' is never negative.
The alternate loop:
for (i = 0; ret > 0; i++) {
struct folio *folio = page_folio(pages[i]);
...
unsigned int len = min(ret, PAGE_SIZE - start);
...
ret -= len;
...
}
would be equivalent and doesn't need 'nfolios'.
Most of the 'unsigned long' actually come from PAGE_SIZE.
Detected by an extra check added to min_t().
Signed-off-by: David Laight <david.laight.linux@gmail.com >
Link: https://patch.msgid.link/20251119224140.8616-31-david.laight.linux@gmail.com
Signed-off-by: Christian Brauner <brauner@kernel.org >
2025-12-15 14:33:37 +01:00
..
2025-12-07 08:29:09 -08:00
2025-07-28 13:43:25 -07:00
2025-10-20 20:22:26 +02:00
2025-12-03 17:24:33 -08:00
2025-12-05 15:52:30 -08:00
2025-10-20 20:22:26 +02:00
2025-12-01 09:02:34 -08:00
2025-12-05 17:01:20 -08:00
2025-12-01 16:13:46 -08:00
2025-12-14 15:24:10 +12:00
2025-10-20 20:22:26 +02:00
2025-12-05 14:36:21 -08:00
2025-10-20 20:22:26 +02:00
2025-12-06 14:01:20 -08:00
2025-12-05 21:29:02 -08:00
2025-11-16 01:35:04 -05:00
2025-11-04 19:10:33 -08:00
2025-12-01 16:13:46 -08:00
2025-12-05 14:36:21 -08:00
2025-10-20 20:22:26 +02:00
2025-12-05 17:01:20 -08:00
2025-12-03 10:00:17 +09:00
2025-10-20 20:22:26 +02:00
2025-12-15 14:33:37 +01:00
2025-12-09 12:06:20 +09:00
2025-12-15 14:33:37 +01:00
2025-10-20 20:22:26 +02:00
2025-12-15 14:33:37 +01:00
2025-12-03 20:28:50 -08:00
2025-12-03 20:08:32 -08:00
2025-12-03 20:08:32 -08:00
2025-12-05 16:30:56 -08:00
2025-12-01 14:18:01 -08:00
2025-12-05 14:36:21 -08:00
2025-12-01 10:26:38 -08:00
2025-12-01 09:02:34 -08:00
2025-11-26 17:05:47 -05:00
2025-10-20 20:22:26 +02:00
2025-12-01 09:02:34 -08:00
2025-12-05 21:29:02 -08:00
2025-12-06 10:57:02 -08:00
2025-12-01 15:22:40 -08:00
2025-12-01 10:26:38 -08:00
2025-12-12 21:52:42 +12:00
2025-08-05 16:45:40 -07:00
2025-12-06 10:57:02 -08:00
2025-12-06 14:01:20 -08:00
2025-12-01 11:58:06 +02:00
2025-12-01 17:32:07 -08:00
2025-12-05 13:52:43 -08:00
2025-12-13 20:55:12 +12:00
2025-12-01 14:18:01 -08:00
2025-10-20 20:22:26 +02:00
2025-12-01 09:02:34 -08:00
2025-12-05 16:16:20 -08:00
2025-12-08 15:32:15 -08:00
2025-12-05 14:36:21 -08:00
2025-10-20 20:22:26 +02:00
2025-10-20 20:22:26 +02:00
2025-10-20 20:22:26 +02:00
2025-12-05 14:36:21 -08:00
2025-12-05 13:52:43 -08:00
2025-10-20 20:22:26 +02:00
2025-12-12 21:59:19 +12:00
2025-10-20 20:22:26 +02:00
2025-11-26 15:16:35 +01:00
2025-11-16 01:35:03 -05:00
2025-12-09 08:50:27 +09:00
2025-10-20 20:22:26 +02:00
2025-10-20 20:22:26 +02:00
2025-09-16 23:59:38 -04:00
2025-09-29 15:55:20 -07:00
2025-12-03 20:19:38 -08:00
2025-12-01 09:02:34 -08:00
2025-11-04 12:36:33 +01:00
2025-11-28 12:42:31 +01:00
2025-11-12 09:38:34 +01:00
2025-12-01 13:45:41 -08:00
2025-07-28 17:11:40 -07:00
2025-11-04 08:33:33 +01:00
2025-12-05 14:36:21 -08:00
2025-09-15 21:17:08 -04:00
2025-12-15 14:33:37 +01:00
2025-12-03 17:24:33 -08:00
2025-12-05 13:52:43 -08:00
2025-12-05 15:25:13 -08:00
2025-07-31 14:57:54 -07:00
2025-10-20 20:22:26 +02:00
2025-11-28 12:42:31 +01:00
2025-11-28 12:42:32 +01:00
2025-12-15 14:33:37 +01:00
2025-11-12 09:38:37 +01:00
2025-11-28 12:42:31 +01:00
2025-11-19 12:17:31 +01:00
2025-10-07 12:48:33 +02:00
2025-12-01 17:32:07 -08:00
2025-09-04 15:20:51 -04:00
2025-11-05 09:51:30 +01:00
2025-11-05 22:51:23 +01:00
2025-12-01 09:20:51 -08:00
2025-08-11 14:52:41 +02:00
2025-11-12 09:38:36 +01:00
2025-12-03 11:14:50 +01:00
2025-12-05 14:36:21 -08:00
2025-09-01 13:08:01 +02:00
2025-10-02 18:18:33 -07:00
2025-09-03 20:49:32 -07:00
2025-12-05 14:36:21 -08:00
2025-11-28 10:30:41 +01:00
2025-11-05 09:51:30 +01:00
2025-11-11 10:01:31 +01:00
2025-09-21 14:22:16 -07:00
2025-12-01 16:13:46 -08:00
2025-12-01 17:32:07 -08:00
2025-12-01 17:32:07 -08:00
2025-12-01 17:32:07 -08:00
2025-12-01 10:17:39 -08:00
2025-12-05 11:15:37 -08:00
2025-09-15 21:26:44 -04:00
2025-09-15 21:26:44 -04:00
2025-11-12 09:38:34 +01:00
2025-08-15 16:11:47 +02:00
2025-11-04 08:28:34 +01:00
2025-11-28 12:42:32 +01:00
2025-12-15 14:33:37 +01:00
2025-09-15 21:17:07 -04:00
2025-12-05 15:52:30 -08:00
2025-12-01 09:20:51 -08:00
2025-11-28 12:42:32 +01:00
2025-12-05 13:52:43 -08:00
2025-12-01 15:34:41 -08:00
2025-11-12 09:38:34 +01:00