[PATCH 2/7] drm/vkms: free the colorop whose initialization failed
From: Oarora Etimis
Date: Sat Nov 28 2026 - 12:16:00 EST
The error path of vkms_initialize_color_pipeline() walks ops[0..i-1],
but ops[i] is already allocated when its drm_plane_colorop_*_init()
call fails, so it leaks.
Include it in the walk.
Fixes: c1e578bd08da ("drm/vkms: Add enumerated 1D curve colorop")
Signed-off-by: Oarora Etimis <oaroraetimis@xxxxxxxxx>
---
drivers/gpu/drm/vkms/vkms_colorop.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/vkms/vkms_colorop.c b/drivers/gpu/drm/vkms/vkms_colorop.c
index 9424b1994239..ed557a1c6a05 100644
--- a/drivers/gpu/drm/vkms/vkms_colorop.c
+++ b/drivers/gpu/drm/vkms/vkms_colorop.c
@@ -126,7 +126,7 @@ static int vkms_initialize_color_pipeline(struct drm_plane *plane, struct drm_pr
return 0;
cleanup:
- for (j = 0; j < i; j++) {
+ for (j = 0; j <= i && j < ARRAY_SIZE(ops); j++) {
if (ops[j]) {
drm_colorop_cleanup(ops[j]);
kfree(ops[j]);
--
2.56.1