linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drivers/video/fbdev: use new array-copying-wrapper
@ 2023-11-02 19:24 Philipp Stanner
  2023-11-05 18:17 ` Helge Deller
  0 siblings, 1 reply; 2+ messages in thread
From: Philipp Stanner @ 2023-11-02 19:24 UTC (permalink / raw)
  To: Florian Tobias Schandinat, Helge Deller
  Cc: linux-fbdev, dri-devel, linux-kernel, Philipp Stanner,
	Dave Airlie

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(-)

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);
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] drivers/video/fbdev: use new array-copying-wrapper
  2023-11-02 19:24 [PATCH] drivers/video/fbdev: use new array-copying-wrapper Philipp Stanner
@ 2023-11-05 18:17 ` Helge Deller
  0 siblings, 0 replies; 2+ messages in thread
From: Helge Deller @ 2023-11-05 18:17 UTC (permalink / raw)
  To: Philipp Stanner, Florian Tobias Schandinat
  Cc: linux-fbdev, dri-devel, linux-kernel, Dave Airlie

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);


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-11-05 18:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-02 19:24 [PATCH] drivers/video/fbdev: use new array-copying-wrapper Philipp Stanner
2023-11-05 18:17 ` Helge Deller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).