[PATCH 1/6] fbdev: Return number of bytes read or written
Geert Uytterhoeven
geert at linux-m68k.org
Wed Apr 26 14:41:47 UTC 2023
Hi Thomas,
On Tue, Apr 25, 2023 at 4:28 PM Thomas Zimmermann <tzimmermann at suse.de> wrote:
> Always return the number of bytes read or written within the
> framebuffer. Only return an errno code if framebuffer memory
> was not touched. This is the semantics required by POSIX and
> makes fb_read() and fb_write() compatible with IGT tests. [1]
>
> This bug has been fixed for fb_write() long ago by
> commit 6a2a88668e90 ("[PATCH] fbdev: Fix return error of
> fb_write"). The code in fb_read() and the corresponding fb_sys_()
> helpers was forgotten.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann at suse.de>
> Link: https://gitlab.freedesktop.org/drm/igt-gpu-tools/-/blob/master/tests/fbdev.c # 1
Thanks for your patch!
> --- a/drivers/video/fbdev/core/fbmem.c
> +++ b/drivers/video/fbdev/core/fbmem.c
> @@ -820,7 +820,7 @@ fb_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
>
> kfree(buffer);
>
> - return (err) ? err : cnt;
> + return cnt ? cnt : err;
> }
Looks all good to me, so
Reviewed-by: Geert Uytterhoeven <geert+renesas at glider.be>
However, shouldn't the copy_to_user() handling in fb_read() be fixed,
too?
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
More information about the dri-devel
mailing list