[PATCH 4/6] drm/i915/gvt: Prevent use of uninitilized member fb_info->obj

Colin Xu colin.xu at intel.com
Wed Mar 20 03:21:28 UTC 2019


fb_info is dumped from vgpu_get_plane_info() and copy to dmabuf_obj->info,
fb_info->obj is not used and (dmabuf_obj->info)->obj is assigned to itself.
To avoid use of uninitialized member, zero out fb_info before the dump.

Signed-off-by: Colin Xu <colin.xu at intel.com>
---
 drivers/gpu/drm/i915/gvt/dmabuf.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/i915/gvt/dmabuf.c b/drivers/gpu/drm/i915/gvt/dmabuf.c
index f27edf17b4ab..49a425d533f4 100644
--- a/drivers/gpu/drm/i915/gvt/dmabuf.c
+++ b/drivers/gpu/drm/i915/gvt/dmabuf.c
@@ -377,6 +377,7 @@ int intel_vgpu_query_plane(struct intel_vgpu *vgpu, void *args)
 			(!gfx_plane_info->flags))
 		return -EINVAL;
 
+	memset(&fb_info, 0, sizeof(fb_info));
 	ret = vgpu_get_plane_info(dev, vgpu, &fb_info,
 					gfx_plane_info->drm_plane_type);
 	if (ret != 0)
-- 
2.21.0



More information about the intel-gvt-dev mailing list