WSL2-Linux-Kernel/drivers/video
Dan Carpenter c3364cbc37 video: fbdev: fbcvt.c: fix printing in fb_cvt_print_name()
[ Upstream commit 78482af095 ]

This code has two bugs:
1) "cnt" is 255 but the size of the buffer is 256 so the last byte is
   not used.
2) If we try to print more than 255 characters then "cnt" will be
   negative and that will trigger a WARN() in snprintf(). The fix for
   this is to use scnprintf() instead of snprintf().

We can re-write this code to be cleaner:
1) Rename "offset" to "off" because that's shorter.
2) Get rid of the "cnt" variable and just use "size - off" directly.
3) Get rid of the "read" variable and just increment "off" directly.

Fixes: 96fe6a2109 ("fbdev: Add VESA Coordinated Video Timings (CVT) support")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-04-08 14:23:15 +02:00
..
backlight backlight: qcom-wled: Respect enabled-strings in set_brightness 2022-01-27 11:03:46 +01:00
console fbcon: Add option to enable legacy hardware acceleration 2022-02-08 18:34:06 +01:00
fbdev video: fbdev: fbcvt.c: fix printing in fb_cvt_print_name() 2022-04-08 14:23:15 +02:00
logo
Kconfig
Makefile
display_timing.c
hdmi.c
of_display_timing.c
of_videomode.c
vgastate.c
videomode.c