Commit 419f8299 authored by Wan Jiabing's avatar Wan Jiabing Committed by Zhi Wang

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: e0f74ed4 ("i915/gvt: Separate the MMIO tracking table from GVT-g")
Signed-off-by: default avatarWan Jiabing <wanjiabing@vivo.com>
Signed-off-by: default avatarZhi Wang <zhi.a.wang@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20220427115457.836729-1-wanjiabing@vivo.comReviewed-by: default avatarZhi Wang <zhi.a.wang@intel.com>
parent 5b95b9d5
...@@ -2916,7 +2916,7 @@ static int init_mmio_block_handlers(struct intel_gvt *gvt) ...@@ -2916,7 +2916,7 @@ static int init_mmio_block_handlers(struct intel_gvt *gvt)
block = find_mmio_block(gvt, VGT_PVINFO_PAGE); block = find_mmio_block(gvt, VGT_PVINFO_PAGE);
if (!block) { if (!block) {
WARN(1, "fail to assign handlers to mmio block %x\n", 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; return -ENODEV;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment