> -----Original Message-----
> From: Borah, Chaitanya Kumar <[email protected]>
> Sent: Friday, December 19, 2025 12:26 PM
> To: [email protected]; [email protected]; intel-
> [email protected]; [email protected]
> Cc: [email protected]; [email protected];
> [email protected]; [email protected]; [email protected];
> [email protected]; [email protected]; Shankar, Uma
> <[email protected]>; Kandpal, Suraj <[email protected]>;
> [email protected]; [email protected]; Roper, Matthew D
> <[email protected]>
> Subject: [PATCH 02/13] drm/amd/display: Fix color pipeline enum name leak
> 
> dm_plane_init_colorops() allocates enum names for color pipelines.
> These are eventually passed to drm_property_create_enum() which create its own
> copies of the string. Free the strings after initialization is done.
> 
> Also, allocate color pipeline enum names only after successfully creating 
> color
> pipeline.

Looks Good to me.
Reviewed-by: Uma Shankar <[email protected]>

@[email protected], @[email protected] Please ack if looks ok to you as 
well.

Regards,
Uma Shankar

> Fixes: 9ba25915efba ("drm/amd/display: Add support for sRGB EOTF in DEGAM
> block")
> Signed-off-by: Chaitanya Kumar Borah <[email protected]>
> ---
>  .../drm/amd/display/amdgpu_dm/amdgpu_dm_colorop.c   |  4 +++-
>  .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c | 13 +++++++++----
>  2 files changed, 12 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_colorop.c
> b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_colorop.c
> index d585618b8064..a2de3bba8346 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_colorop.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_colorop.c
> @@ -79,7 +79,6 @@ int amdgpu_dm_initialize_default_pipeline(struct drm_plane
> *plane, struct drm_pr
>               goto cleanup;
> 
>       list->type = ops[i]->base.id;
> -     list->name = kasprintf(GFP_KERNEL, "Color Pipeline %d", ops[i]-
> >base.id);
> 
>       i++;
> 
> @@ -197,6 +196,9 @@ int amdgpu_dm_initialize_default_pipeline(struct
> drm_plane *plane, struct drm_pr
>               goto cleanup;
> 
>       drm_colorop_set_next_property(ops[i-1], ops[i]);
> +
> +     list->name = kasprintf(GFP_KERNEL, "Color Pipeline %d",
> +ops[0]->base.id);
> +
>       return 0;
> 
>  cleanup:
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c
> b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c
> index 2e3ee78999d9..7c4496fb4b9d 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c
> @@ -1790,12 +1790,13 @@ dm_atomic_plane_get_property(struct drm_plane
> *plane,  static int  dm_plane_init_colorops(struct drm_plane *plane)  {
> -     struct drm_prop_enum_list pipelines[MAX_COLOR_PIPELINES];
> +     struct drm_prop_enum_list pipelines[MAX_COLOR_PIPELINES] = {};
>       struct drm_device *dev = plane->dev;
>       struct amdgpu_device *adev = drm_to_adev(dev);
>       struct dc *dc = adev->dm.dc;
>       int len = 0;
> -     int ret;
> +     int ret = 0;
> +     int i;
> 
>       if (plane->type == DRM_PLANE_TYPE_CURSOR)
>               return 0;
> @@ -1806,7 +1807,7 @@ dm_plane_init_colorops(struct drm_plane *plane)
>               if (ret) {
>                       drm_err(plane->dev, "Failed to create color pipeline for
> plane %d: %d\n",
>                               plane->base.id, ret);
> -                     return ret;
> +                     goto out;
>               }
>               len++;
> 
> @@ -1814,7 +1815,11 @@ dm_plane_init_colorops(struct drm_plane *plane)
>               drm_plane_create_color_pipeline_property(plane, pipelines, len);
>       }
> 
> -     return 0;
> +out:
> +     for (i = 0; i < len; i++)
> +             kfree(pipelines[i].name);
> +
> +     return ret;
>  }
>  #endif
> 
> --
> 2.25.1

Reply via email to