[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <063fbed8-915e-47e5-99fd-ffae22cfb6fa@suse.de>
Date: Tue, 23 Sep 2025 08:34:14 +0200
From: Thomas Zimmermann <tzimmermann@...e.de>
To: Mehdi Ben Hadj Khelifa <mehdi.benhadjkhelifa@...il.com>,
maarten.lankhorst@...ux.intel.com, mripard@...nel.org, airlied@...il.com,
simona@...ll.ch, mingo@...nel.org, tglx@...utronix.de, jfalempe@...hat.com,
skhan@...uxfoundation.org, david.hunter.linux@...il.com,
Ruben Wauters <rubenru09@....com>
Cc: dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org,
linux-kernel-mentees@...ts.linuxfoundation.org
Subject: Re: [PATCH] drm/gud: Use kmalloc_array() instead of kmalloc()
cc Ruben
Am 22.09.25 um 19:43 schrieb Mehdi Ben Hadj Khelifa:
> Replace kmalloc with kmalloc array in drm/gud/gud_pipe.c since the
> calculation inside kmalloc is dynamic "width * height" and added
> u_char as the size of each element.
>
> Signed-off-by: Mehdi Ben Hadj Khelifa <mehdi.benhadjkhelifa@...il.com>
> ---
> drivers/gpu/drm/gud/gud_pipe.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/gud/gud_pipe.c b/drivers/gpu/drm/gud/gud_pipe.c
> index 8d548d08f127..eeea0cb4c7aa 100644
> --- a/drivers/gpu/drm/gud/gud_pipe.c
> +++ b/drivers/gpu/drm/gud/gud_pipe.c
> @@ -70,7 +70,7 @@ static size_t gud_xrgb8888_to_r124(u8 *dst, const struct drm_format_info *format
> height = drm_rect_height(rect);
> len = drm_format_info_min_pitch(format, 0, width) * height;
>
> - buf = kmalloc(width * height, GFP_KERNEL);
> + buf = kmalloc_array(width * height, sizeof(u_char), GFP_KERNEL);
> if (!buf)
> return 0;
>
--
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)
Powered by blists - more mailing lists