Skip to content

Commit f06875d

Browse files
committed
fbdev: Use screen_buffer in fb_sys_{read,write}()
Use info->screen_buffer when reading and writing framebuffers in system memory. It's the correct pointer for this address space. The struct fb_info has a union to store the framebuffer memory. This can either be info->screen_base if the framebuffer is stored in I/O memory, or info->screen_buffer if the framebuffer is stored in system memory. Since the fb_sys_{read,write}() functions operate on the latter address space, it is wrong to use .screen_base and .screen_buffer must be used instead. This also gets rid of all the casting needed due to not using the correct data type. v2: * add detailed commit message (Javier) 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-16-tzimmermann@suse.de
1 parent 921b738 commit f06875d

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/video/fbdev/core/fb_sys_fops.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ ssize_t fb_sys_read(struct fb_info *info, char __user *buf, size_t count,
3939
if (count + p > total_size)
4040
count = total_size - p;
4141

42-
src = (void __force *)(info->screen_base + p);
42+
src = info->screen_buffer + p;
4343

4444
if (info->fbops->fb_sync)
4545
info->fbops->fb_sync(info);
@@ -87,7 +87,7 @@ ssize_t fb_sys_write(struct fb_info *info, const char __user *buf,
8787
count = total_size - p;
8888
}
8989

90-
dst = (void __force *) (info->screen_base + p);
90+
dst = info->screen_buffer + p;
9191

9292
if (info->fbops->fb_sync)
9393
info->fbops->fb_sync(info);

0 commit comments

Comments
 (0)