[6/8] drm/i915/gvt: Fix check error on fence mmio handler

Submitted by Wang, Zhi A on Feb. 28, 2018, 11:52 a.m.

Details

Message ID F3B0350DF4CB6849A642218320DE483D7D6DC1C9@SHSMSX104.ccr.corp.intel.com
State New
Headers show
Series "Series without cover letter" ( rev: 1 ) in Intel GVT devel

Not browsing as part of any series.

Commit Message

Wang, Zhi A Feb. 28, 2018, 11:52 a.m.
Reviewed-by: Zhi Wang <zhi.a.wang@intel.com>


-----Original Message-----
From: intel-gvt-dev [mailto:intel-gvt-dev-bounces@lists.freedesktop.org] On Behalf Of Zhenyu Wang

Sent: Thursday, February 22, 2018 3:16 PM
To: intel-gvt-dev@lists.freedesktop.org
Subject: [PATCH 6/8] drm/i915/gvt: Fix check error on fence mmio handler

Fix below error with minor code refactor.

CHECK   drivers/gpu/drm/i915//gvt/handlers.c
drivers/gpu/drm/i915//gvt/handlers.c:203 sanitize_fence_mmio_access() error: 'vgpu' dereferencing possible ERR_PTR()

Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>

---
 drivers/gpu/drm/i915/gvt/handlers.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

 			gvt_vgpu_err("total fence %d, access fence %d\n",
-					vgpu_fence_sz(vgpu), fence_num);
+				     max_fence, fence_num);
 		}
 		memset(p_data, 0, bytes);
 		return -EINVAL;
--
2.16.1

_______________________________________________
intel-gvt-dev mailing list
intel-gvt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gvt-dev

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/i915/gvt/handlers.c b/drivers/gpu/drm/i915/gvt/handlers.c
index fbb908e797c4..415ef4556e67 100644
--- a/drivers/gpu/drm/i915/gvt/handlers.c
+++ b/drivers/gpu/drm/i915/gvt/handlers.c
@@ -188,7 +188,9 @@  void enter_failsafe_mode(struct intel_vgpu *vgpu, int reason)  static int sanitize_fence_mmio_access(struct intel_vgpu *vgpu,
 		unsigned int fence_num, void *p_data, unsigned int bytes)  {
-	if (fence_num >= vgpu_fence_sz(vgpu)) {
+	unsigned int max_fence = vgpu_fence_sz(vgpu);
+
+	if (fence_num >= max_fence) {
 
 		/* When guest access oob fence regs without access
 		 * pv_info first, we treat guest not supporting GVT, @@ -201,7 +203,7 @@ static int sanitize_fence_mmio_access(struct intel_vgpu *vgpu,
 		if (!vgpu->mmio.disable_warn_untrack) {
 			gvt_vgpu_err("found oob fence register access\n");