On 25.07.2022 11:25, Gwan-gyeong Mun wrote:
There is an impedance mismatch between the first/last valid page frame number of ttm place in unsigned and our memory/page accounting in unsigned long. As the object size is under the control of userspace, we have to be prudent and catch the conversion errors. To catch the implicit truncation as we switch from unsigned long to unsigned, we use overflows_type check and report E2BIG or overflow_type prior to the operation.v3: Not to change execution inside a macro. (Mauro) Add safe_conversion_gem_bug_on() macro and remove temporal SAFE_CONVERSION() macro. v4: Fix unhandled GEM_BUG_ON() macro call from safe_conversion_gem_bug_on() Signed-off-by: Gwan-gyeong Mun <[email protected]> Cc: Chris Wilson <[email protected]> Cc: Matthew Auld <[email protected]> Cc: Thomas Hellström <[email protected]> Reviewed-by: Nirmoy Das <[email protected]> Reviewed-by: Mauro Carvalho Chehab <[email protected]> Reported-by: kernel test robot <[email protected]>
Reviewed-by: Andrzej Hajda <[email protected]> Regards Andrzej
