mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-22 11:21:16 +07:00
d8e9b2b909
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:
|
||
---|---|---|
.. | ||
aperture_gm.c | ||
cfg_space.c | ||
cmd_parser.c | ||
cmd_parser.h | ||
debug.h | ||
display.c | ||
display.h | ||
edid.c | ||
edid.h | ||
execlist.c | ||
execlist.h | ||
firmware.c | ||
gtt.c | ||
gtt.h | ||
gvt.c | ||
gvt.h | ||
handlers.c | ||
hypercall.h | ||
interrupt.c | ||
interrupt.h | ||
kvmgt.c | ||
Makefile | ||
mmio.c | ||
mmio.h | ||
mpt.h | ||
opregion.c | ||
reg.h | ||
render.c | ||
render.h | ||
sched_policy.c | ||
sched_policy.h | ||
scheduler.c | ||
scheduler.h | ||
trace_points.c | ||
trace.h | ||
vgpu.c |