aboutsummaryrefslogtreecommitdiff
path: root/drivers/video/videomode.c
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2021-09-16 16:29:19 +0300
committerHelge Deller <deller@gmx.de>2022-01-30 21:19:22 +0100
commit78482af095abd9f4f29f1aa3fe575d25c6ae3028 (patch)
treef054c00089fc29c67e6b9d16961ed1fa8ab4c3b5 /drivers/video/videomode.c
parent6a3827ea4e2bccf89aa74654afbaf627e3dc64c9 (diff)
video: fbdev: fbcvt.c: fix printing in fb_cvt_print_name()
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: 96fe6a2109db ("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>
Diffstat (limited to 'drivers/video/videomode.c')
0 files changed, 0 insertions, 0 deletions