All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Lyude Paul" <lyude@redhat.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v3 2/3] drm/nouveau/kms/nv50-: Introduce nv50_wndw_default_state()
Date: Mon, 20 Jul 2026 22:06:32 +0000	[thread overview]
Message-ID: <20260720220633.0A6851F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260720215058.398210-3-lyude@redhat.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Unconditional dereference of `wndw->plane.state` which may be NULL if the initial state allocation fails.
--

--- Patch [2]: [PATCH v3 2/3] drm/nouveau/kms/nv50-: Introduce nv50_wndw_default_state() ---
commit 2d2dcbda94d37e6b985a1775b04d636840fd94c1
Author: Lyude Paul <lyude@redhat.com>

drm/nouveau/kms/nv50-: Introduce nv50_wndw_default_state()

This commit introduces nv50_wndw_default_state() to ensure the initial
atomic state for a window always starts with a supported value in
pixel_blend_mode. It hooks this function into nv50_display_read_hw_state()
to enforce a valid blend mode value during driver startup.

> diff --git a/drivers/gpu/drm/nouveau/dispnv50/wndw.c b/drivers/gpu/drm/nouveau/dispnv50/wndw.c
> index 2635458d52acc..dfa1ba45acd99 100644
> --- a/drivers/gpu/drm/nouveau/dispnv50/wndw.c
> +++ b/drivers/gpu/drm/nouveau/dispnv50/wndw.c

[ ... ]

> +/*
> + * Setup defaults for the atomic wndw state
> + */
> +void
> +nv50_wndw_default_state(struct nv50_wndw *wndw)
> +{
> +	struct nv50_wndw_atom *armw = nv50_wndw_atom(wndw->plane.state);
> +	const unsigned int blend_modes = wndw->func->blend_modes;
> +
> +	drm_modeset_lock_assert_held(&wndw->plane.mutex);
> +
> +	/* Ensure the plane's atomic state didn't default to a pixel_blend_mode we don't support */
> +	if (blend_modes && (!(BIT(armw->state.pixel_blend_mode) & blend_modes))) {

[Severity: High]
Could this dereference a NULL pointer if memory allocation fails during
drm_mode_config_reset()?

If plane state allocation fails in the plane's reset hook, wndw->plane.state
is left as NULL. When nv50_display_read_hw_state() subsequently calls this
function, armw will evaluate to NULL, leading to a fault when accessing
armw->state.pixel_blend_mode.

> +		if (blend_modes & BIT(DRM_MODE_BLEND_COVERAGE))
> +			armw->state.pixel_blend_mode = DRM_MODE_BLEND_COVERAGE;
> +		else if (blend_modes & BIT(DRM_MODE_BLEND_PREMULTI))
> +			armw->state.pixel_blend_mode = DRM_MODE_BLEND_PREMULTI;
> +		else if (blend_modes & BIT(DRM_MODE_BLEND_PIXEL_NONE))
> +			armw->state.pixel_blend_mode = DRM_MODE_BLEND_PIXEL_NONE;
> +	}
> +}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260720215058.398210-1-lyude@redhat.com?part=2

  reply	other threads:[~2026-07-20 22:06 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-20 21:36 [PATCH v3 0/3] drm/nouveau: Fix WARN_ON() from missing blend modes Lyude Paul
2026-07-20 21:36 ` Lyude Paul
2026-07-20 21:36 ` [PATCH v3 1/3] drm/nouveau/kms/nv50-: Add .blend_modes to nv50_wndw_func Lyude Paul
2026-07-20 21:36   ` Lyude Paul
2026-07-20 21:59   ` sashiko-bot
2026-07-20 21:36 ` [PATCH v3 2/3] drm/nouveau/kms/nv50-: Introduce nv50_wndw_default_state() Lyude Paul
2026-07-20 21:36   ` Lyude Paul
2026-07-20 22:06   ` sashiko-bot [this message]
2026-07-20 22:10     ` lyude
2026-07-20 21:36 ` [PATCH v3 3/3] drm/nouveau/kms/nv50-: Unconditionally create blend_mode prop for wndws Lyude Paul
2026-07-20 21:36   ` Lyude Paul

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=20260720220633.0A6851F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=lyude@redhat.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.