All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Maxime Ripard" <mripard@kernel.org>
Cc: linux-sunxi@lists.linux.dev
Subject: Re: [PATCH v5 14/19] drm/hdmi: Rename __drm_atomic_helper_connector_hdmi_reset()
Date: Tue, 19 May 2026 09:13:54 +0000	[thread overview]
Message-ID: <20260519091355.15823C2BCB3@smtp.kernel.org> (raw)
In-Reply-To: <20260519-drm-mode-config-init-v5-14-388b03321e38@kernel.org>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] __drm_atomic_helper_connector_hdmi_state_init() dereferences new_conn_state without a NULL check, leading to a kernel panic if state allocation fails in drm_atomic_helper_connector_reset(). This problem wasn't introduced by this patch, but existed in the previous implementation.
--

commit ca36932b2899a887d5e634584333e43a5290dc5b
Author: Maxime Ripard <mripard@kernel.org>

drm/hdmi: Rename __drm_atomic_helper_connector_hdmi_reset()

This commit renames __drm_atomic_helper_connector_hdmi_reset() to
__drm_atomic_helper_connector_hdmi_state_init(). This prepares for
consolidating DRM objects state allocation around the atomic_create_state
callback.

> diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c
> index a161d3b00a255..74dce4be0c008 100644
> --- a/drivers/gpu/drm/vc4/vc4_hdmi.c
> +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
> @@ -508,7 +508,7 @@ static int vc4_hdmi_connector_atomic_check(struct drm_connector *connector,
>  static void vc4_hdmi_connector_reset(struct drm_connector *connector)
>  {
>  	drm_atomic_helper_connector_reset(connector);
> -	__drm_atomic_helper_connector_hdmi_reset(connector, connector->state);
> +	__drm_atomic_helper_connector_hdmi_state_init(connector, connector->state);

Can this result in a NULL pointer dereference if memory allocation fails?

This problem appears to have existed prior to this patch, but remains present.

If kzalloc_obj() fails inside drm_atomic_helper_connector_reset(), it will
set connector->state to NULL. This NULL pointer is then passed into
__drm_atomic_helper_connector_hdmi_state_init():

void __drm_atomic_helper_connector_hdmi_state_init(...,
						   struct drm_connector_state *new_conn_state)
{
	...
	new_conn_state->max_bpc = max_bpc;
	...
}

Does this code need a check for new_conn_state before dereferencing it,
or should the caller check if connector->state is valid before calling this
initialization function?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260519-drm-mode-config-init-v5-0-388b03321e38@kernel.org?part=14

  reply	other threads:[~2026-05-19  9:13 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-19  9:01 [PATCH v5 00/19] drm/atomic: Rework initial state allocation Maxime Ripard
2026-05-19  9:01 ` [PATCH v5 01/19] drm/atomic: Document atomic commit lifetime Maxime Ripard
2026-05-26  8:59   ` Thomas Zimmermann
2026-05-19  9:01 ` [PATCH v5 02/19] drm/colorop: Fix typos in the doc Maxime Ripard
2026-05-19  9:01 ` [PATCH v5 03/19] drm/atomic: Drop drm_private_obj.state assignment from create_state Maxime Ripard
2026-05-19 11:35   ` sashiko-bot
2026-05-26  9:03   ` Thomas Zimmermann
2026-05-19  9:01 ` [PATCH v5 04/19] drm/atomic: Expand atomic_create_state expectations for drm_private_obj Maxime Ripard
2026-05-26  9:03   ` Thomas Zimmermann
2026-05-19  9:01 ` [PATCH v5 05/19] drm/mode-config: Document drm_private_obj exclusion from drm_mode_config_reset() Maxime Ripard
2026-05-26  9:05   ` Thomas Zimmermann
2026-05-19  9:01 ` [PATCH v5 06/19] drm/colorop: Rename __drm_colorop_state_reset() Maxime Ripard
2026-05-19  9:01 ` [PATCH v5 07/19] drm/colorop: Create drm_atomic_helper_colorop_create_state() Maxime Ripard
2026-05-19  9:34   ` sashiko-bot
2026-05-19  9:01 ` [PATCH v5 08/19] drm/atomic-state-helper: Fix __drm_atomic_helper_plane_reset() doc typo Maxime Ripard
2026-05-19  9:01 ` [PATCH v5 09/19] drm/atomic-state-helper: Rename __drm_atomic_helper_plane_state_reset() Maxime Ripard
2026-05-19  9:01 ` [PATCH v5 10/19] drm/plane: Add new atomic_create_state callback Maxime Ripard
2026-05-26  9:08   ` Thomas Zimmermann
2026-05-19  9:01 ` [PATCH v5 11/19] drm/atomic-state-helper: Rename __drm_atomic_helper_crtc_state_reset() Maxime Ripard
2026-05-19  9:01 ` [PATCH v5 12/19] drm/crtc: Add new atomic_create_state callback Maxime Ripard
2026-05-26  9:22   ` Thomas Zimmermann
2026-05-19  9:01 ` [PATCH v5 13/19] drm/atomic-state-helper: Rename __drm_atomic_helper_connector_state_reset() Maxime Ripard
2026-05-19  9:01 ` [PATCH v5 14/19] drm/hdmi: Rename __drm_atomic_helper_connector_hdmi_reset() Maxime Ripard
2026-05-19  9:13   ` sashiko-bot [this message]
2026-05-19  9:01 ` [PATCH v5 15/19] drm/connector: Add new atomic_create_state callback Maxime Ripard
2026-05-26  9:28   ` Thomas Zimmermann
2026-05-19  9:01 ` [PATCH v5 16/19] drm/mode-config: Create drm_mode_config_create_initial_state() Maxime Ripard
2026-05-26  9:33   ` Thomas Zimmermann
2026-05-19  9:01 ` [PATCH v5 17/19] drm/drv: Switch skeleton to drm_mode_config_create_initial_state() Maxime Ripard
2026-05-26  9:34   ` Thomas Zimmermann
2026-05-19  9:02 ` [PATCH v5 18/19] drm/tidss: Convert to atomic_create_state Maxime Ripard
2026-05-19  9:02 ` [PATCH v5 19/19] drm/bridge_connector: " Maxime Ripard
2026-05-19  9:09 ` ✗ CI.checkpatch: warning for drm/atomic: Rework initial state allocation (rev4) Patchwork
2026-05-19  9:10 ` ✓ CI.KUnit: success " Patchwork
2026-05-19  9:49 ` ✓ Xe.CI.BAT: " Patchwork
2026-05-19 13:12 ` ✗ i915.CI.BAT: failure " Patchwork
2026-05-19 19:24 ` ✗ Xe.CI.FULL: " Patchwork
2026-05-26  9:36 ` [PATCH v5 00/19] drm/atomic: Rework initial state allocation Thomas Zimmermann

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=20260519091355.15823C2BCB3@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=mripard@kernel.org \
    --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.