linux_dsm_epyc7002/drivers/gpu/drm/i915/gvt
Takashi Iwai d8e9b2b909 drm/i915/gvt: Fix superfluous newline in GVT_DISPLAY_READY env var
send_display_send_uevent() sends two environment variable, and the
first one GVT_DISPLAY_READY is set including a new line at the end of
the string; that is obviously superfluous and wrong -- at least, it
*looks* so when you only read the code.

However, it doesn't appear in the actual output by a (supposedly
unexpected) trick.  The code uses snprintf() and truncates the string
in size 20 bytes.  This makes the string as GVT_DISPLAY_READY=0 or
...=1 including the trailing NUL-letter.  That is, the '\n' found in
the format string is always cut off as a result.

Although the code gives the correct result, it is confusing.  This
patch addresses it, just removing the superfluous '\n' from the format
string for avoiding further confusion.  If the argument "ready" were
not a  bool, the size 20 should be corrected as well.  But it's a
bool, so we can leave the magic number 20 as is for now.

FWIW, the bug was spotted by a new GCC7 warning:
  drivers/gpu/drm/i915/gvt/handlers.c: In function 'pvinfo_mmio_write':
  drivers/gpu/drm/i915/gvt/handlers.c:1042:34: error: 'snprintf' output truncated before the last format character [-Werror=format-truncation=]
    snprintf(display_ready_str, 20, "GVT_DISPLAY_READY=%d\n", ready);
                                    ^~~~~~~~~~~~~~~~~~~~~~~~
  drivers/gpu/drm/i915/gvt/handlers.c:1042:2: note: 'snprintf' output 21 bytes into a destination of size 20
    snprintf(display_ready_str, 20, "GVT_DISPLAY_READY=%d\n", ready);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Fixes: 04d348ae3f ("drm/i915/gvt: vGPU display virtualization")
Bugzilla: https://bugzilla.suse.com/show_bug.cgi?id=1025903
Reported-by: Richard Biener <rguenther@suse.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
2017-02-23 17:32:14 +08:00
..
aperture_gm.c drm/i915/gvt: Fix alignment for GTT allocation 2017-02-14 17:03:30 +08:00
cfg_space.c drm/i915/gvt: introduced failsafe mode into vgpu 2017-02-17 16:03:38 +08:00
cmd_parser.c drm/i915/gvt: add sprite plane flip done support. 2017-02-14 17:09:19 +08:00
cmd_parser.h drm/i915/gvt: vGPU command scanner 2016-10-14 18:15:25 +08:00
debug.h drm/i915/gvt: vGPU command scanner 2016-10-14 18:15:25 +08:00
display.c drm/i915/gvt: add missing display part reset for vGPU reset 2017-02-14 17:09:02 +08:00
display.h drm/i915/gvt: add missing display part reset for vGPU reset 2017-02-14 17:09:02 +08:00
edid.c drm/i915/gvt: Fix static checker warning on intel_gvt_i2c_handle_aux_ch_write() 2016-11-14 18:06:44 +08:00
edid.h drm/i915/gvt: Fix static checker warning on intel_gvt_i2c_handle_aux_ch_write() 2016-11-14 18:06:44 +08:00
execlist.c drm/i915/gvt: fix crash at function release_shadow_wa_ctx 2017-02-10 16:50:18 +08:00
execlist.h drm/i915/gvt: fix crash in vgpu_reset_execlist 2016-11-14 18:06:43 +08:00
firmware.c drm/i915/gvt: use normal mmio read function for firmware exposure 2017-02-07 17:21:55 +08:00
gtt.c drm/i915/gvt: Map shadow page before using it in shadow page table 2017-02-09 14:17:14 +08:00
gtt.h drm/i915/gvt: introuduce intel_vgpu_reset_gtt() to reset gtt 2017-01-13 15:05:38 +08:00
gvt.c drm/i915/gvt: enable IOMMU for gvt 2017-02-09 14:17:15 +08:00
gvt.h drm/i915/gvt: enter failsafe mode when guest requires more resources 2017-02-23 17:32:13 +08:00
handlers.c drm/i915/gvt: Fix superfluous newline in GVT_DISPLAY_READY env var 2017-02-23 17:32:14 +08:00
hypercall.h drm/i915/gvt: remove detect_host() MPT hook 2017-02-07 17:21:44 +08:00
interrupt.c drm/i915/gvt: add sprite plane flip done support. 2017-02-14 17:09:19 +08:00
interrupt.h drm/i915/gvt: vGPU command scanner 2016-10-14 18:15:25 +08:00
kvmgt.c drm/i915/gvt: return error code if dma map iova failed 2017-02-14 17:35:39 +08:00
Makefile drm/i915/gvt/kvmgt: add vfio/mdev support to KVMGT 2016-12-16 16:55:26 +08:00
mmio.c drm/i915/gvt: handle fence reg access during GPU reset 2017-02-17 16:36:31 +08:00
mmio.h drm/i915/gvt: introduce intel_vgpu_reset_mmio() to reset mmio space 2017-01-13 15:05:38 +08:00
mpt.h drm/i915/gvt: remove detect_host() MPT hook 2017-02-07 17:21:44 +08:00
opregion.c drm/i915/gvt: Fix check error on opregion.c 2017-02-17 14:56:36 +08:00
reg.h drm/i915/gvt: cleanup opregion memory allocation code 2017-01-09 11:11:32 +08:00
render.c drm/i915/gvt: optimize the inhibit context mmio load 2017-02-14 17:35:39 +08:00
render.h drm/i915/gvt: vGPU context switch 2016-10-14 18:15:13 +08:00
sched_policy.c drm/i915/gvt: remove a noisy unimportant log in sched_policy 2017-02-09 14:13:30 +08:00
sched_policy.h drm/i915/gvt: vGPU schedule policy framework 2016-10-14 18:15:02 +08:00
scheduler.c drm/i915/gvt: add a NULL pointer check to avoid kernel panic 2017-02-23 17:32:13 +08:00
scheduler.h drm/i915/gvt: vGPU command scanner 2016-10-14 18:15:25 +08:00
trace_points.c drm/i915/gvt: trace stub 2016-10-14 18:12:11 +08:00
trace.h drm/i915/gvt: vGPU command scanner 2016-10-14 18:15:25 +08:00
vgpu.c drm/i915/gvt: introduced failsafe mode into vgpu 2017-02-17 16:03:38 +08:00