drm/i915/gvt: Initialize intel_gvt_gtt_entry in stack
authorTina Zhang <tina.zhang@intel.com>
Wed, 22 May 2019 22:18:36 +0000 (06:18 +0800)
committerZhenyu Wang <zhenyuw@linux.intel.com>
Thu, 30 May 2019 03:30:15 +0000 (11:30 +0800)
commit387a4c2b55291b37e245c840813bd8a8bd06ed49
tree296bfc78a7ff9e249c6e10297bea3ee6a757fd8a
parent591c39ffac4ab1ddf2ea6d49331cb614e0682b28
drm/i915/gvt: Initialize intel_gvt_gtt_entry in stack

Stack struct intel_gvt_gtt_entry value needs to be initialized before
being used, as the fields may contain garbage values.

W/o this patch, set_ggtt_entry prints:
-------------------------------------
274.046840: set_ggtt_entry: vgpu1:set ggtt entry 0x9bed8000ffffe900
274.046846: set_ggtt_entry: vgpu1:set ggtt entry 0xe55df001
274.046852: set_ggtt_entry: vgpu1:set ggtt entry 0x9bed8000ffffe900

0x9bed8000 is the stack grabage.

W/ this patch, set_ggtt_entry prints:
------------------------------------
274.046840: set_ggtt_entry: vgpu1:set ggtt entry 0xffffe900
274.046846: set_ggtt_entry: vgpu1:set ggtt entry 0xe55df001
274.046852: set_ggtt_entry: vgpu1:set ggtt entry 0xffffe900

v2:
- Initialize during declaration. (Zhenyu)

Fixes: 7598e8700e9a ("drm/i915/gvt: Missed to cancel dma map for ggtt entries")
Cc: stable@vger.kernel.org # v4.20+
Cc: Zhenyu Wang <zhenyuw@linux.intel.com>
Reviewed-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Tina Zhang <tina.zhang@intel.com>
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
drivers/gpu/drm/i915/gvt/gtt.c