From: Mehdi Ben Hadj Khelifa Date: Tue, 7 Oct 2025 08:32:40 +0000 (+0100) Subject: drm/gud: Use kmalloc_array() instead of kmalloc() X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6035258463167e2cda7af64669f925a43e0b7e88;p=thirdparty%2Fkernel%2Flinux.git drm/gud: Use kmalloc_array() instead of kmalloc() Replace kmalloc with kmalloc array in drm/gud/gud_pipe.c since the calculation inside kmalloc is dynamic 'width * height' Signed-off-by: Mehdi Ben Hadj Khelifa Acked-by: Ruben Wauters Acked-by: Thomas Zimmermann Signed-off-by: Thomas Zimmermann Link: https://lore.kernel.org/r/20251007083320.29018-1-mehdi.benhadjkhelifa@gmail.com --- diff --git a/drivers/gpu/drm/gud/gud_pipe.c b/drivers/gpu/drm/gud/gud_pipe.c index 3a208e956dff7..76d77a736d84a 100644 --- a/drivers/gpu/drm/gud/gud_pipe.c +++ b/drivers/gpu/drm/gud/gud_pipe.c @@ -69,7 +69,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(height, width, GFP_KERNEL); if (!buf) return 0;