All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Melissa Wen" <mwen@igalia.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v3 5/7] drm/amd/display: make shaper bypass mode cleaner
Date: Tue, 09 Jun 2026 12:32:56 +0000	[thread overview]
Message-ID: <20260609123256.ED5DB1F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260609121230.1358786-6-mwen@igalia.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:

New issues:
- [High] Removing the `enabled` fallback leaves the shaper transfer function in a corrupted state if an invalid 1D LUT size is provided.

Pre-existing issues:
- [High] Atomic check silently ignores invalid colorop LUT sizes and allocation failures in the blend transfer function.
--

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

drm/amd/display: make shaper bypass mode cleaner

Start shaper tranfer function setup in bypass mode, i.e. tf->type ==
TF_TYPE_BYPASS and let the helper checks set it to a different mode
according to userspace request.

> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c
> index 13ad7ac1e35e4..4651241433296 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c
> @@ -1648,10 +1648,11 @@ __set_dm_plane_colorop_shaper(struct drm_plane_state *plane_state,
>  	struct dc_transfer_func *tf = &dc_plane_state->in_shaper_func;
>  	const struct drm_color_lut32 *shaper_lut;
>  	struct drm_device *dev = colorop->dev;
> -	bool enabled = false;
>  	u32 shaper_size;
>  	int i = 0, ret = 0;
>  
> +	tf->type = TF_TYPE_BYPASS;
> +
>  	/* 1D Curve - SHAPER TF */
>  	old_colorop = colorop;
>  	for_each_new_colorop_in_state(state, colorop, new_colorop_state, i) {

[ ... ]

> @@ -1702,13 +1702,9 @@ __set_dm_plane_colorop_shaper(struct drm_plane_state *plane_state,
>  			ret = __set_output_tf_32(tf, shaper_lut, shaper_size, false);
>  			if (ret)
>  				return ret;
> -			enabled = true;
>  		}
>  	}
>  
> -	if (!enabled)
> -		tf->type = TF_TYPE_BYPASS;
> -
>  	return 0;
>  }

[Severity: High]
Does removing the enabled fallback leave the shaper transfer function in a
corrupted state if an invalid 1D LUT size is provided?

If userspace sets bypass = false but provides an invalid LUT size or unsets
the data blob (size = 0), the check for shaper_size == colorop->size fails
and __set_output_tf_32() is skipped in __set_dm_plane_colorop_shaper().

Since tf->type was already set to TF_TYPE_DISTRIBUTED_POINTS earlier in the
function, and we no longer fall back to TF_TYPE_BYPASS when enabled is false,
the function returns 0. Could this cause the atomic commit to succeed while
programming the hardware with an uninitialized transfer function?

[Severity: High]
This is a pre-existing issue, but a similar problem exists in
__set_dm_plane_colorop_blend().

Does the atomic check silently ignore invalid colorop LUT sizes and allocation
failures in the blend transfer function?

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c:__set_dm_plane_colorop_blend() {
	...
		/* Custom LUT size must be the same as supported size */
		if (blend_size == colorop->size)
			__set_input_tf_32(NULL, tf, blend_lut, blend_size);
	}

	return 0;
}

If the size check fails, __set_input_tf_32() is skipped entirely, but the
function returns 0. Also, the return value of __set_input_tf_32() is ignored,
meaning allocation failures are not propagated. Could this allow the hardware
to be programmed with an uninitialized or partially initialized transfer
function?

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

  reply	other threads:[~2026-06-09 12:32 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-09 11:51 [PATCH v3 0/7] don't allow changes to inactive colorops Melissa Wen
2026-06-09 11:51 ` [PATCH v3 1/7] drm/atomic: only add states of active or transient active colorops Melissa Wen
2026-06-09 12:33   ` sashiko-bot
2026-06-09 11:51 ` [PATCH v3 2/7] drm/atomic: reject colorop update from inactive color pipeline Melissa Wen
2026-06-09 12:37   ` sashiko-bot
2026-06-09 11:51 ` [PATCH v3 3/7] drm/amd/display: don't check colorop status if its in an inactive pipeline Melissa Wen
2026-06-09 11:51 ` [PATCH v3 4/7] drm/amd/display: truly bypass plane colorop 3x4 matrix and hdr mult Melissa Wen
2026-06-09 12:33   ` sashiko-bot
2026-06-09 11:51 ` [PATCH v3 5/7] drm/amd/display: make shaper bypass mode cleaner Melissa Wen
2026-06-09 12:32   ` sashiko-bot [this message]
2026-06-09 11:51 ` [PATCH v3 6/7] drm/amd/display: fix bnld colorop bypass mode Melissa Wen
2026-06-09 12:51   ` sashiko-bot
2026-06-09 11:51 ` [PATCH v3 7/7] drm/amd/display: allow individual colorop changes Melissa Wen
2026-06-09 12:50   ` sashiko-bot
2026-06-09 12:50 ` ✗ CI.checkpatch: warning for don't allow changes to inactive colorops (rev3) Patchwork
2026-06-09 12:51 ` ✓ CI.KUnit: success " Patchwork
2026-06-09 13:32 ` ✓ Xe.CI.BAT: " Patchwork
2026-06-09 13:36 ` ✓ i915.CI.BAT: " Patchwork

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=20260609123256.ED5DB1F00893@smtp.kernel.org \
    --to=sashiko-bot@kernel.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.