[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20220427115457.836729-1-wanjiabing@vivo.com>
Date: Wed, 27 Apr 2022 19:54:56 +0800
From: Wan Jiabing <wanjiabing@...o.com>
To: Zhenyu Wang <zhenyuw@...ux.intel.com>,
Zhi Wang <zhi.a.wang@...el.com>,
Jani Nikula <jani.nikula@...ux.intel.com>,
Joonas Lahtinen <joonas.lahtinen@...ux.intel.com>,
Rodrigo Vivi <rodrigo.vivi@...el.com>,
Tvrtko Ursulin <tvrtko.ursulin@...ux.intel.com>,
David Airlie <airlied@...ux.ie>,
Daniel Vetter <daniel@...ll.ch>,
intel-gvt-dev@...ts.freedesktop.org,
intel-gfx@...ts.freedesktop.org, dri-devel@...ts.freedesktop.org,
linux-kernel@...r.kernel.org
Cc: Wan Jiabing <wanjiabing@...o.com>
Subject: [PATCH] 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@...o.com>
---
drivers/gpu/drm/i915/gvt/handlers.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/i915/gvt/handlers.c b/drivers/gpu/drm/i915/gvt/handlers.c
index cf00398c2870..7ffe0fb512a9 100644
--- a/drivers/gpu/drm/i915/gvt/handlers.c
+++ b/drivers/gpu/drm/i915/gvt/handlers.c
@@ -2922,7 +2922,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;
}
--
2.35.3
Powered by blists - more mailing lists