Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

fbdev: Don't re-validate info->state in fb_ops implementations

The file-op entry points fb_read() and fb_write() verify that
info->state has been set to FBINFO_STATE_RUNNING. Remove the same
test from the implementations of struct fb_ops.{fb_read,fb_write}.

v2:
* also remove test from ivtvfb, braodsheetfb, hecubafb and
metronomefb (Geert)

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Tested-by: Sui Jingfeng <suijingfeng@loongson.cn>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Helge Deller <deller@gmx.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20230428122452.4856-17-tzimmermann@suse.de

-24
-3
drivers/media/pci/ivtv/ivtvfb.c
··· 378 378 unsigned long dma_size; 379 379 u16 lead = 0, tail = 0; 380 380 381 - if (info->state != FBINFO_STATE_RUNNING) 382 - return -EPERM; 383 - 384 381 total_size = info->screen_size; 385 382 386 383 if (total_size == 0)
-3
drivers/video/fbdev/broadsheetfb.c
··· 1013 1013 int err = 0; 1014 1014 unsigned long total_size; 1015 1015 1016 - if (info->state != FBINFO_STATE_RUNNING) 1017 - return -EPERM; 1018 - 1019 1016 total_size = info->fix.smem_len; 1020 1017 1021 1018 if (p > total_size)
-6
drivers/video/fbdev/core/fb_sys_fops.c
··· 22 22 unsigned long total_size, c; 23 23 ssize_t ret; 24 24 25 - if (info->state != FBINFO_STATE_RUNNING) 26 - return -EPERM; 27 - 28 25 total_size = info->screen_size; 29 26 30 27 if (total_size == 0) ··· 60 63 int err = 0; 61 64 unsigned long total_size, c; 62 65 size_t ret; 63 - 64 - if (info->state != FBINFO_STATE_RUNNING) 65 - return -EPERM; 66 66 67 67 total_size = info->screen_size; 68 68
-3
drivers/video/fbdev/hecubafb.c
··· 163 163 int err = 0; 164 164 unsigned long total_size; 165 165 166 - if (info->state != FBINFO_STATE_RUNNING) 167 - return -EPERM; 168 - 169 166 total_size = info->fix.smem_len; 170 167 171 168 if (p > total_size)
-3
drivers/video/fbdev/metronomefb.c
··· 523 523 int err = 0; 524 524 unsigned long total_size; 525 525 526 - if (info->state != FBINFO_STATE_RUNNING) 527 - return -EPERM; 528 - 529 526 total_size = info->fix.smem_len; 530 527 531 528 if (p > total_size)
-6
drivers/video/fbdev/sm712fb.c
··· 1031 1031 if (!info || !info->screen_base) 1032 1032 return -ENODEV; 1033 1033 1034 - if (info->state != FBINFO_STATE_RUNNING) 1035 - return -EPERM; 1036 - 1037 1034 total_size = info->screen_size; 1038 1035 1039 1036 if (total_size == 0) ··· 1093 1096 1094 1097 if (!info || !info->screen_base) 1095 1098 return -ENODEV; 1096 - 1097 - if (info->state != FBINFO_STATE_RUNNING) 1098 - return -EPERM; 1099 1099 1100 1100 total_size = info->screen_size; 1101 1101