From 0f0b33b5b5c20ff1d71d40b6668ca5e17e16ef18 Mon Sep 17 00:00:00 2001 From: stefan11111 Date: Tue, 15 Jul 2025 23:38:05 +0300 Subject: [PATCH] glamor: if glamor_get_modifiers make *num_modifiers 0, make *modifiers NULL This likely wasn't a problem, as *num_modifiers was 0, so likely no data was read from a potentially uninitilaized pointer, but it's still better to explicitly set it to NULL. Signed-off-by: stefan11111 --- glamor/glamor_egl.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/glamor/glamor_egl.c b/glamor/glamor_egl.c index 0b4eca0e1..a0ac0a2f0 100644 --- a/glamor/glamor_egl.c +++ b/glamor/glamor_egl.c @@ -787,10 +787,12 @@ glamor_get_modifiers(ScreenPtr screen, uint32_t format, #ifdef GLAMOR_HAS_EGL_QUERY_DMABUF struct glamor_egl_screen_private *glamor_egl; EGLint num; +#endif - /* Explicitly zero the count as the caller may ignore the return value */ + /* Explicitly zero the count and modifiers as the caller may ignore the return value */ *num_modifiers = 0; - + *modifiers = NULL; +#ifdef GLAMOR_HAS_EGL_QUERY_DMABUF glamor_egl = glamor_egl_get_screen_private(xf86ScreenToScrn(screen)); if (!glamor_egl->dmabuf_capable) @@ -814,11 +816,8 @@ glamor_get_modifiers(ScreenPtr screen, uint32_t format, } *num_modifiers = num; - return TRUE; -#else - *num_modifiers = 0; - return TRUE; #endif + return TRUE; } const char *