fbdev: Validate info->screen_{base, buffer} in fb_ops implementations
authorThomas Zimmermann <tzimmermann@suse.de>
Fri, 28 Apr 2023 12:24:50 +0000 (14:24 +0200)
committerThomas Zimmermann <tzimmermann@suse.de>
Mon, 8 May 2023 13:28:34 +0000 (15:28 +0200)
commit3f8974f68f408f4983443b745a3cf95b06112469
tree7bf2c45c6d071b3d865efaa6135cb5d70e24069d
parent453bd91302f16ddb8a2f5eb3df9fda3206dbacef
fbdev: Validate info->screen_{base, buffer} in fb_ops implementations

Push the test for info->screen_base from fb_read() and fb_write() into
the implementations of struct fb_ops.{fb_read,fb_write}. In cases where
the driver operates on info->screen_buffer, test this field instead.

While bothi fields, screen_base and screen_buffer, are stored in the
same location, they refer to different address spaces. For correctness,
we want to test each field in exactly the code that uses it.

v2:
* also test screen_base in pvr2fb (Geert)
* also test screen_buffer in ivtvfb, arcfb, broadsheetfb,
  hecubafb, metronomefb and ssd1307fb (Geert)
* give a rational for the change (Geert)

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Tested-by: Sui Jingfeng <suijingfeng@loongson.cn>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Acked-by: Helge Deller <deller@gmx.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20230428122452.4856-18-tzimmermann@suse.de
drivers/media/pci/ivtv/ivtvfb.c
drivers/video/fbdev/arcfb.c
drivers/video/fbdev/broadsheetfb.c
drivers/video/fbdev/cobalt_lcdfb.c
drivers/video/fbdev/core/fb_sys_fops.c
drivers/video/fbdev/core/fbmem.c
drivers/video/fbdev/hecubafb.c
drivers/video/fbdev/metronomefb.c
drivers/video/fbdev/pvr2fb.c
drivers/video/fbdev/sm712fb.c
drivers/video/fbdev/ssd1307fb.c