diff mbox series

[3/6] fbdev: Don't re-validate info->state in fb_ops implementations

Message ID 20230425142846.730-4-tzimmermann@suse.de
State New
Headers show
Series drm,fbdev: Use fbdev's I/O helpers | expand

Commit Message

Thomas Zimmermann April 25, 2023, 2:28 p.m. UTC
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}.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/video/fbdev/core/fb_sys_fops.c | 6 ------
 drivers/video/fbdev/sm712fb.c          | 6 ------
 2 files changed, 12 deletions(-)

Comments

Javier Martinez Canillas April 25, 2023, 4:38 p.m. UTC | #1
Thomas Zimmermann <tzimmermann@suse.de> writes:

> 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}.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---

Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Sui Jingfeng April 26, 2023, 9:49 a.m. UTC | #2
Tested-by: Sui Jingfeng <suijingfeng@loongson.cn>


On 2023/4/25 22:28, Thomas Zimmermann wrote:
> 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}.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
> ---
>   drivers/video/fbdev/core/fb_sys_fops.c | 6 ------
>   drivers/video/fbdev/sm712fb.c          | 6 ------
>   2 files changed, 12 deletions(-)
>
> diff --git a/drivers/video/fbdev/core/fb_sys_fops.c b/drivers/video/fbdev/core/fb_sys_fops.c
> index 6589123f4127..7dee5d3c7fb1 100644
> --- a/drivers/video/fbdev/core/fb_sys_fops.c
> +++ b/drivers/video/fbdev/core/fb_sys_fops.c
> @@ -22,9 +22,6 @@ ssize_t fb_sys_read(struct fb_info *info, char __user *buf, size_t count,
>   	unsigned long total_size, c;
>   	ssize_t ret;
>   
> -	if (info->state != FBINFO_STATE_RUNNING)
> -		return -EPERM;
> -
>   	total_size = info->screen_size;
>   
>   	if (total_size == 0)
> @@ -64,9 +61,6 @@ ssize_t fb_sys_write(struct fb_info *info, const char __user *buf,
>   	unsigned long total_size, c;
>   	size_t ret;
>   
> -	if (info->state != FBINFO_STATE_RUNNING)
> -		return -EPERM;
> -
>   	total_size = info->screen_size;
>   
>   	if (total_size == 0)
> diff --git a/drivers/video/fbdev/sm712fb.c b/drivers/video/fbdev/sm712fb.c
> index b528776c7612..6f852cd756c5 100644
> --- a/drivers/video/fbdev/sm712fb.c
> +++ b/drivers/video/fbdev/sm712fb.c
> @@ -1031,9 +1031,6 @@ static ssize_t smtcfb_read(struct fb_info *info, char __user *buf,
>   	if (!info || !info->screen_base)
>   		return -ENODEV;
>   
> -	if (info->state != FBINFO_STATE_RUNNING)
> -		return -EPERM;
> -
>   	total_size = info->screen_size;
>   
>   	if (total_size == 0)
> @@ -1097,9 +1094,6 @@ static ssize_t smtcfb_write(struct fb_info *info, const char __user *buf,
>   	if (!info || !info->screen_base)
>   		return -ENODEV;
>   
> -	if (info->state != FBINFO_STATE_RUNNING)
> -		return -EPERM;
> -
>   	total_size = info->screen_size;
>   
>   	if (total_size == 0)
Geert Uytterhoeven April 26, 2023, 2:49 p.m. UTC | #3
Hi Thomas,

On Tue, Apr 25, 2023 at 4:28 PM Thomas Zimmermann <tzimmermann@suse.de> wrote:
> 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}.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>

Thanks for your patch!

>  drivers/video/fbdev/core/fb_sys_fops.c | 6 ------
>  drivers/video/fbdev/sm712fb.c          | 6 ------

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

But there are several other fbdev drivers to fix:
drivers/media/pci/ivtv/ivtvfb.c
drivers/video/fbdev/broadsheetfb.c
drivers/video/fbdev/hecubafb.c
drivers/video/fbdev/metronomefb.c

Gr{oetje,eeting}s,

                        Geert
Thomas Zimmermann April 26, 2023, 3:07 p.m. UTC | #4
Hi

Am 26.04.23 um 16:49 schrieb Geert Uytterhoeven:
> Hi Thomas,
> 
> On Tue, Apr 25, 2023 at 4:28 PM Thomas Zimmermann <tzimmermann@suse.de> wrote:
>> 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}.
>>
>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> 
> Thanks for your patch!
> 
>>   drivers/video/fbdev/core/fb_sys_fops.c | 6 ------
>>   drivers/video/fbdev/sm712fb.c          | 6 ------
> 
> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
> 
> But there are several other fbdev drivers to fix:
> drivers/media/pci/ivtv/ivtvfb.c
> drivers/video/fbdev/broadsheetfb.c
> drivers/video/fbdev/hecubafb.c
> drivers/video/fbdev/metronomefb.c

Ok, I'll go through the various patches in this patchset and check if 
they need to be done elsewhere as well.

Best regards
Thomas

> 
> Gr{oetje,eeting}s,
> 
>                          Geert
>
diff mbox series

Patch

diff --git a/drivers/video/fbdev/core/fb_sys_fops.c b/drivers/video/fbdev/core/fb_sys_fops.c
index 6589123f4127..7dee5d3c7fb1 100644
--- a/drivers/video/fbdev/core/fb_sys_fops.c
+++ b/drivers/video/fbdev/core/fb_sys_fops.c
@@ -22,9 +22,6 @@  ssize_t fb_sys_read(struct fb_info *info, char __user *buf, size_t count,
 	unsigned long total_size, c;
 	ssize_t ret;
 
-	if (info->state != FBINFO_STATE_RUNNING)
-		return -EPERM;
-
 	total_size = info->screen_size;
 
 	if (total_size == 0)
@@ -64,9 +61,6 @@  ssize_t fb_sys_write(struct fb_info *info, const char __user *buf,
 	unsigned long total_size, c;
 	size_t ret;
 
-	if (info->state != FBINFO_STATE_RUNNING)
-		return -EPERM;
-
 	total_size = info->screen_size;
 
 	if (total_size == 0)
diff --git a/drivers/video/fbdev/sm712fb.c b/drivers/video/fbdev/sm712fb.c
index b528776c7612..6f852cd756c5 100644
--- a/drivers/video/fbdev/sm712fb.c
+++ b/drivers/video/fbdev/sm712fb.c
@@ -1031,9 +1031,6 @@  static ssize_t smtcfb_read(struct fb_info *info, char __user *buf,
 	if (!info || !info->screen_base)
 		return -ENODEV;
 
-	if (info->state != FBINFO_STATE_RUNNING)
-		return -EPERM;
-
 	total_size = info->screen_size;
 
 	if (total_size == 0)
@@ -1097,9 +1094,6 @@  static ssize_t smtcfb_write(struct fb_info *info, const char __user *buf,
 	if (!info || !info->screen_base)
 		return -ENODEV;
 
-	if (info->state != FBINFO_STATE_RUNNING)
-		return -EPERM;
-
 	total_size = info->screen_size;
 
 	if (total_size == 0)