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 <gwan-gyeong....@intel.com>
Cc: Chris Wilson <ch...@chris-wilson.co.uk>
Cc: Matthew Auld <matthew.a...@intel.com>
Cc: Thomas Hellström <thomas.hellst...@linux.intel.com>
Reviewed-by: Nirmoy Das <nirmoy....@intel.com>
Reviewed-by: Mauro Carvalho Chehab <mche...@kernel.org>
Reported-by: kernel test robot <l...@intel.com>
Reviewed-by: Andrzej Hajda <andrzej.ha...@intel.com>
Regards
Andrzej