[Intel-gfx] [PATCH v5 4/7] drm/i915: Check for integer truncation on the configuration of ttm place
Andrzej Hajda
andrzej.hajda at intel.com
Mon Jul 25 11:53:33 UTC 2022
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.mun at intel.com>
> Cc: Chris Wilson <chris at chris-wilson.co.uk>
> Cc: Matthew Auld <matthew.auld at intel.com>
> Cc: Thomas Hellström <thomas.hellstrom at linux.intel.com>
> Reviewed-by: Nirmoy Das <nirmoy.das at intel.com>
> Reviewed-by: Mauro Carvalho Chehab <mchehab at kernel.org>
> Reported-by: kernel test robot <lkp at intel.com>
Reviewed-by: Andrzej Hajda <andrzej.hajda at intel.com>
Regards
Andrzej
More information about the Intel-gfx
mailing list