diff options
author | Wan Jiabing <wanjiabing@vivo.com> | 2022-04-27 13:54:56 +0200 |
---|---|---|
committer | Zhi Wang <zhi.a.wang@intel.com> | 2022-04-28 23:06:02 +0200 |
commit | 419f8299ddad6070a6c95aaedf78e50265871f36 (patch) | |
tree | 5adcc74213b06d6d77a9d616a44179ddd29026b0 | |
parent | drm/i915/gvt: Fix the compiling error when CONFIG_DRM_I915_DEBUG_RUNTIME_PM=n (diff) | |
download | linux-419f8299ddad6070a6c95aaedf78e50265871f36.tar.xz linux-419f8299ddad6070a6c95aaedf78e50265871f36.zip |
i915/gvt: Fix NULL pointer dereference in init_mmio_block_handlers
Fix following coccicheck error:
./drivers/gpu/drm/i915/gvt/handlers.c:2925:35-41: ERROR: block is NULL but dereferenced.
Use gvt->mmio.mmio_block instead of block to avoid NULL pointer
dereference when find_mmio_block returns NULL.
Fixes: e0f74ed4634d ("i915/gvt: Separate the MMIO tracking table from GVT-g")
Signed-off-by: Wan Jiabing <wanjiabing@vivo.com>
Signed-off-by: Zhi Wang <zhi.a.wang@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20220427115457.836729-1-wanjiabing@vivo.com
Reviewed-by: Zhi Wang <zhi.a.wang@intel.com>
-rw-r--r-- | drivers/gpu/drm/i915/gvt/handlers.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gpu/drm/i915/gvt/handlers.c b/drivers/gpu/drm/i915/gvt/handlers.c index 3ce1a5a9e2da..ad31640c9bf2 100644 --- a/drivers/gpu/drm/i915/gvt/handlers.c +++ b/drivers/gpu/drm/i915/gvt/handlers.c @@ -2916,7 +2916,7 @@ static int init_mmio_block_handlers(struct intel_gvt *gvt) block = find_mmio_block(gvt, VGT_PVINFO_PAGE); if (!block) { WARN(1, "fail to assign handlers to mmio block %x\n", - i915_mmio_reg_offset(block->offset)); + i915_mmio_reg_offset(gvt->mmio.mmio_block->offset)); return -ENODEV; } |