[Intel-gfx] [PATCH 1/1] static analysis failure
Thomas Hellström (Intel)
thomas_os at shipmail.org
Thu Dec 2 09:06:31 UTC 2021
On 12/2/21 05:38, Pallavi Mishra wrote:
> fix for null ptr dereferences.
Please describe the change as per the patch submission guidelines:
https://www.kernel.org/doc/html/latest/process/submitting-patches.html#describe-your-changes
In particular, describe the *real* problems and the fixes, and not only
that this silences a
static analysis tool. If the problems were found with such a tool, then
that can be added as as a side note.
>
> Signed-off-by: Pallavi Mishra <pallavi.mishra at intel.com>
> ---
> drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 3 +++
> drivers/gpu/drm/i915/gem/i915_gem_ttm_move.c | 4 +++-
> 2 files changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c b/drivers/gpu/drm/i915/gem/i915_gem_ttm.c
> index 218a9b3037c7..997fe73c205b 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_ttm.c
> @@ -906,6 +906,8 @@ vm_access_ttm(struct vm_area_struct *area, unsigned long addr,
> struct drm_i915_gem_object *obj =
> i915_ttm_to_gem(area->vm_private_data);
>
> + GEM_BUG_ON(!obj);
> +
> if (i915_gem_object_is_readonly(obj) && write)
> return -EACCES;
>
> @@ -966,6 +968,7 @@ static const struct drm_i915_gem_object_ops i915_gem_ttm_obj_ops = {
> void i915_ttm_bo_destroy(struct ttm_buffer_object *bo)
> {
> struct drm_i915_gem_object *obj = i915_ttm_to_gem(bo);
> + GEM_BUG_ON(!obj);
>
> i915_gem_object_release_memory_region(obj);
> mutex_destroy(&obj->ttm.get_io_page.lock);
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_ttm_move.c b/drivers/gpu/drm/i915/gem/i915_gem_ttm_move.c
> index 80df9f592407..12ba05d44d0f 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_ttm_move.c
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_ttm_move.c
> @@ -369,8 +369,10 @@ void i915_ttm_adjust_gem_after_move(struct drm_i915_gem_object *obj)
> int i915_ttm_move_notify(struct ttm_buffer_object *bo)
> {
> struct drm_i915_gem_object *obj = i915_ttm_to_gem(bo);
> +
Stray blank line change.
> int ret;
>
> + GEM_BUG_ON(!obj);
> ret = i915_gem_object_unbind(obj, I915_GEM_OBJECT_UNBIND_ACTIVE);
> if (ret)
> return ret;
> @@ -506,7 +508,7 @@ static void i915_ttm_memcpy_init(struct i915_ttm_memcpy_arg *arg,
>
> dst_reg = i915_ttm_region(bo->bdev, dst_mem->mem_type);
> src_reg = i915_ttm_region(bo->bdev, bo->resource->mem_type);
> - GEM_BUG_ON(!dst_reg || !src_reg);
> + GEM_BUG_ON(!dst_reg || !src_reg || !obj);
>
> arg->dst_iter = !i915_ttm_cpu_maps_iomem(dst_mem) ?
> ttm_kmap_iter_tt_init(&arg->_dst_iter.tt, dst_ttm) :
Thanks,
Thomas
More information about the Intel-gfx
mailing list