All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Melissa Wen" <mwen@igalia.com>
Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v3 17/19] drm/amd/display: enable post-blend CTM colorop
Date: Tue, 24 Nov 2026 18:46:15 +0000	[thread overview]
Message-ID: <sashiko-outbox-231850@kernel.org> (raw)
In-Reply-To: <20261124181652.1333986-18-mwen@igalia.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] drm/amd/display: NULL deref on kasprintf() failure in CRTC
  pipeline init
- [Medium] drm/amd/display: missing error unwind in
  amdgpu_dm_crtc_init()
--

commit a6af21490f0a9bf347d95f27bc66b20a42758591
Author: Melissa Wen <mwen@igalia.com>

drm/amd/display: enable post-blend CTM colorop

This commit initializes the AMD post-blend color pipeline on DCN 3.0 and
newer with a 3x4 CTM colorop and programs it when a CRTC color pipeline is
active.

Link: https://dri.freedesktop.org/docs/drm/gpu/amdgpu/display/display-manager.html#dc-color-capabilities-between-dcn-generations

> 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 c6bb9fec92175..dcd497b644c11 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
> @@ -305,3 +305,41 @@ int amdgpu_dm_initialize_default_pipeline(struct drm_plane *plane, struct drm_pr
>  	return amdgpu_dm_build_default_pipeline(dev, plane, hw_3d_lut, list);
>  }
>  EXPORT_IF_KUNIT(amdgpu_dm_initialize_default_pipeline);
> +
> +int amdgpu_dm_initialize_crtc_default_pipeline(struct drm_crtc *crtc,
> +					       struct drm_prop_enum_list *list)
> +{
> +	struct drm_colorop *ops[MAX_COLOR_PIPELINE_OPS];
> +	struct drm_device *dev = crtc->dev;
> +	int ret;
> +	int i = 0;
> +
> +	memset(ops, 0, sizeof(ops));
> +
> +	/* 3x4 matrix */
> +	ops[i] = kzalloc_obj(struct drm_colorop);
> +	if (!ops[i]) {
> +		ret = -ENOMEM;
> +		goto cleanup;
> +	}
> +
> +	ret = drm_crtc_colorop_ctm_3x4_init(dev, ops[i], crtc, &dm_colorop_funcs,
> +					    DRM_COLOROP_FLAG_ALLOW_BYPASS);
> +	if (ret)
> +		goto cleanup;
> +
> +	list->type = ops[i]->base.id;
> +
> +	i++;
> +
> +	list->name = kasprintf(GFP_KERNEL, "Color Pipeline %d", ops[0]->base.id);
> +
> +	return 0;

[Severity: Medium]
What happens if kasprintf() returns NULL here?  Unlike
amdgpu_dm_build_default_pipeline(), this returns 0 with list->name set to
NULL, so dm_crtc_init_colorops() passes pipelines[0].name to
drm_crtc_create_color_pipeline_property() -> drm_property_add_enum(),
causing a NULL pointer dereference in strlen(name) and skipping cleanup of
the initialized colorop.

[ ... ]

> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c
> index 3e0128a29d775..af8be7f8784d3 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c

[ ... ]

> @@ -840,6 +878,10 @@ int amdgpu_dm_crtc_init(struct amdgpu_display_manager *dm,
>  
>  #ifdef AMD_PRIVATE_COLOR
>  	dm_crtc_additional_color_mgmt(&acrtc->base);
> +#else
> +	res = dm_crtc_init_colorops(&acrtc->base);
> +	if (res)
> +		return res;
>  #endif
>  	return 0;

[Severity: Medium]
Should a failure in dm_crtc_init_colorops() clear
dm->adev->mode_info.crtcs[crtc_index] and jump to error_ism_fini instead of
returning directly?  Returning early skips amdgpu_dm_ism_flush(),
drm_crtc_cleanup(), drm_plane_cleanup(), and freeing acrtc and
cursor_plane, leaving the partially initialized CRTC registered in
mode_config and stored in mode_info.crtcs[crtc_index].

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261124181652.1333986-1-mwen@igalia.com?part=17

  reply	other threads:[~2026-11-24 18:46 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-24 18:03 [PATCH v3 00/19] drm/drm_colorop: add post-blend colorop support to AMD display driver Melissa Wen
2026-11-24 18:03 ` [PATCH v3 01/19] drm/crtc: Add color pipeline to CRTC state Melissa Wen
2026-11-24 18:03 ` [PATCH v3 02/19] drm/colorop: Allow parenting colorop to CRTC Melissa Wen
2026-11-24 18:03 ` [PATCH v3 03/19] drm/atomic: handle CRTC colorops in drm_atomic_commit_set_colorop_state() Melissa Wen
2026-11-24 18:03 ` [PATCH v3 04/19] drm/atomic: duplicate CRTC colorop states Melissa Wen
2026-11-24 18:03 ` [PATCH v3 05/19] drm: Factor out common color_pipeline property initialization code Melissa Wen
2026-11-24 18:03 ` [PATCH v3 06/19] drm/crtc: Add COLOR_PIPELINE property Melissa Wen
2026-11-24 18:03 ` [PATCH v3 07/19] drm/atomic: track individual CRTC colorop updates Melissa Wen
2026-11-24 18:03 ` [PATCH v3 08/19] drm: Introduce DRM_CLIENT_CAP_CRTC_COLOR_PIPELINE Melissa Wen
2026-11-24 18:03 ` [PATCH v3 09/19] drm/atomic: Print the color pipeline as part of the CRTC state print Melissa Wen
2026-11-24 18:03 ` [PATCH v3 10/19] drm/colorop: Factor out common paths from colorops helpers Melissa Wen
2026-11-24 18:36   ` sashiko-bot
2026-11-24 18:03 ` [PATCH v3 11/19] drm/colorop: Introduce colorop helpers for crtc Melissa Wen
2026-11-24 18:36   ` sashiko-bot
2026-11-24 18:03 ` [PATCH v3 12/19] drm/colorop: distinguish whether a colorop belongs to a plane or a CRTC Melissa Wen
2026-11-24 18:03 ` [PATCH v3 13/19] drm/drm_mode_object: hide deprecated CRTC color mgmt props if colorop is set Melissa Wen
2026-11-24 18:03 ` [PATCH v3 14/19] drm/atomic: set hidden CRTC color mgmt model to default values Melissa Wen
2026-11-24 18:42   ` sashiko-bot
2026-11-24 18:03 ` [PATCH v3 15/19] drm/drm_ioctl: guard DRM_CLIENT_CAP_CRTC_COLOR_PIPELINE Melissa Wen
2026-11-24 18:03 ` [PATCH v3 16/19] drm/amd/display: move CRTC CTM color mgmt prop to check helper Melissa Wen
2026-11-24 18:03 ` [PATCH v3 17/19] drm/amd/display: enable post-blend CTM colorop Melissa Wen
2026-11-24 18:46   ` sashiko-bot [this message]
2026-11-24 18:03 ` [PATCH v3 18/19] drm/amd/display: add support to post-blend 1D-Curve colorop Melissa Wen
2026-11-24 18:42   ` sashiko-bot
2026-11-24 18:03 ` [PATCH v3 19/19] drm/amd/display: add support to post-blend 1D-LUT colorop Melissa Wen
2026-11-24 18:38   ` sashiko-bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-231850@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=mwen@igalia.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.