[PATCH 19/44] drivers/gpu/drm/amd: use min() instead of min_t()

2025-11-19 Thread david . laight . linux
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. min_t(u8, a, b) is particularly likely to be problematic In this case I think the values ar

[PATCH 00/44] Change a lot of min_t() that might mask high bits

2025-11-19 Thread david . laight . linux
From: David Laight It in not uncommon for code to use min_t(uint, a, b) when one of a or b is 64bit and can have a value that is larger than 2^32; This is particularly prevelant with: uint_var = min_t(uint, uint_var, uint64_expression); Casts to u8 and u16 are very likely to discard sign