diff mbox series

drivers/video/fbdev: use new array-copying-wrapper

Message ID 20231102192402.53721-2-pstanner@redhat.com
State New
Headers show
Series drivers/video/fbdev: use new array-copying-wrapper | expand

Commit Message

Philipp Stanner Nov. 2, 2023, 7:24 p.m. UTC
viafbdev.c utilizes memdup_user() to copy an array from userspace.

There is a new wrapper, specifically designed for copying arrays. Use
this one instead.

Suggested-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Philipp Stanner <pstanner@redhat.com>
---
 drivers/video/fbdev/via/viafbdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Helge Deller Nov. 5, 2023, 6:17 p.m. UTC | #1
On 11/2/23 20:24, Philipp Stanner wrote:
> viafbdev.c utilizes memdup_user() to copy an array from userspace.
>
> There is a new wrapper, specifically designed for copying arrays. Use
> this one instead.
>
> Suggested-by: Dave Airlie <airlied@redhat.com>
> Signed-off-by: Philipp Stanner <pstanner@redhat.com>

applied.

Thanks!
Helge


> ---
>   drivers/video/fbdev/via/viafbdev.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/video/fbdev/via/viafbdev.c b/drivers/video/fbdev/via/viafbdev.c
> index 58868f8880d6..a52b1ba43a48 100644
> --- a/drivers/video/fbdev/via/viafbdev.c
> +++ b/drivers/video/fbdev/via/viafbdev.c
> @@ -574,7 +574,7 @@ static int viafb_ioctl(struct fb_info *info, u_int cmd, u_long arg)
>   		break;
>
>   	case VIAFB_SET_GAMMA_LUT:
> -		viafb_gamma_table = memdup_user(argp, 256 * sizeof(u32));
> +		viafb_gamma_table = memdup_array_user(argp, 256, sizeof(u32));
>   		if (IS_ERR(viafb_gamma_table))
>   			return PTR_ERR(viafb_gamma_table);
>   		viafb_set_gamma_table(viafb_bpp, viafb_gamma_table);
diff mbox series

Patch

diff --git a/drivers/video/fbdev/via/viafbdev.c b/drivers/video/fbdev/via/viafbdev.c
index 58868f8880d6..a52b1ba43a48 100644
--- a/drivers/video/fbdev/via/viafbdev.c
+++ b/drivers/video/fbdev/via/viafbdev.c
@@ -574,7 +574,7 @@  static int viafb_ioctl(struct fb_info *info, u_int cmd, u_long arg)
 		break;
 
 	case VIAFB_SET_GAMMA_LUT:
-		viafb_gamma_table = memdup_user(argp, 256 * sizeof(u32));
+		viafb_gamma_table = memdup_array_user(argp, 256, sizeof(u32));
 		if (IS_ERR(viafb_gamma_table))
 			return PTR_ERR(viafb_gamma_table);
 		viafb_set_gamma_table(viafb_bpp, viafb_gamma_table);