Linux kernel and device drivers for NXP i.MX platforms
 help / color / mirror / Atom feed
From: "Ze Huang" <ze.huang@oss.qualcomm.com>
To: <sashiko-reviews@lists.linux.dev>,
	"Ze Huang" <ze.huang@oss.qualcomm.com>
Cc: <Frank.Li@kernel.org>, <dri-devel@lists.freedesktop.org>,
	<imx@lists.linux.dev>
Subject: Re: [PATCH v2 2/8] drm/aspeed: replace struct drm_simple_display_pipe with regular atomic helpers
Date: Sun, 19 Jul 2026 01:21:14 +0800	[thread overview]
Message-ID: <DK1VC0BQUHEL.3R0D087PCM7KY@oss.qualcomm.com> (raw)
In-Reply-To: <20260716092750.933B81F00A3A@smtp.kernel.org>

On Thu Jul 16, 2026 at 5:27 PM CST, sashiko-bot wrote:
> Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
>
> New issues:
> - [Low] Missing `inline` keyword on `to_aspeed_gfx` in a header file.
>
> Pre-existing issues:
> - [Critical] Direct dereference of `obj->state` inside atomic helpers leads to potential use-after-free and NULL pointer dereferences.
> --
>
> --- Patch [2]: [PATCH v2 2/8] drm/aspeed: replace struct drm_simple_display_pipe with regular atomic helpers ---
> (Note: The format of this report is altered to a free-form summary due to
> automated recitation restrictions. Code snippets are not quoted directly.)
>
> commit d1e92d6b727d3655d12a72430c723784264108f5
> Author: Ze Huang <ze.huang@oss.qualcomm.com>
> Subject: drm/aspeed: replace struct drm_simple_display_pipe with regular atomic helpers
>
> This commit replaces the simple display pipe with explicit plane, CRTC, and
> encoder objects in the aspeed DRM driver. It moves callbacks to their
> respective atomic helpers and shifts page-flip event handling to the CRTC
> atomic flush path.
>
> Issue 1: Missing inline keyword
> File: drivers/gpu/drm/aspeed/aspeed_gfx.h
> Function: to_aspeed_gfx
>
> [Severity: Low]
> Does this function need the inline keyword? The to_aspeed_gfx function is
> defined as static in a header file without being marked inline. Could this
> cause duplicate unreferenced copies of the function to be emitted in every
> translation unit that includes the header, potentially leading to binary
> bloat or compiler warnings when compiled with -Werror?

Will do, here and other places in series

>
> Issue 2: Direct state dereference in atomic context
> File: drivers/gpu/drm/aspeed/aspeed_gfx_crtc.c
> Functions: aspeed_gfx_set_pixel_fmt and aspeed_gfx_crtc_mode_set_nofb
>
> [Severity: Critical]
> This is a pre-existing issue, but is it safe to directly dereference the
> object state pointers here? In aspeed_gfx_set_pixel_fmt, the code directly
> accesses priv->plane.state->fb->format->format. Similarly, in
> aspeed_gfx_crtc_mode_set_nofb, it directly accesses
> priv->crtc.state->adjusted_mode.
>
> Since this is accessed during atomic commits, if a second non-blocking
> commit disables the plane before the first commit reaches its atomic enable
> execution, the plane state could be updated to a new state with a NULL
> framebuffer. When the first commit's worker eventually reads the state,
> could this lead to a NULL pointer dereference and a kernel crash? Would it
> be safer to pass the specific plane and CRTC states down from the atomic
> helpers instead of reading them directly from the objects?

As noted in my reply to patch 5, I'll access the state with atomic helpers
instead.

  reply	other threads:[~2026-07-18 17:21 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-16  9:01 [PATCH v2 0/8] drm: replace simple display pipe users with atomic helpers Ze Huang
2026-07-16  9:01 ` [PATCH v2 1/8] drm/arcpgu: replace struct drm_simple_display_pipe with regular " Ze Huang
2026-07-16  9:15   ` sashiko-bot
2026-07-18 17:15     ` Ze Huang
2026-07-16  9:01 ` [PATCH v2 2/8] drm/aspeed: " Ze Huang
2026-07-16  9:27   ` sashiko-bot
2026-07-18 17:21     ` Ze Huang [this message]
2026-07-16  9:01 ` [PATCH v2 3/8] drm/mcde: " Ze Huang
2026-07-16  9:21   ` sashiko-bot
2026-07-18 17:52     ` Ze Huang
2026-07-16  9:01 ` [PATCH v2 4/8] drm/pl111: " Ze Huang
2026-07-16  9:26   ` sashiko-bot
2026-07-18 18:05     ` Ze Huang
2026-07-16  9:01 ` [PATCH v2 5/8] drm/gm12u320: " Ze Huang
2026-07-16  9:14   ` sashiko-bot
2026-07-17  7:18   ` Thomas Zimmermann
2026-07-18 15:42     ` Ze Huang
2026-07-16  9:01 ` [PATCH v2 6/8] drm/repaper: " Ze Huang
2026-07-16  9:21   ` sashiko-bot
2026-07-18 18:16     ` Ze Huang
2026-07-16  9:01 ` [PATCH v2 7/8] drm/tve200: " Ze Huang
2026-07-16  9:25   ` sashiko-bot
2026-07-18 18:22     ` Ze Huang
2026-07-16  9:02 ` [PATCH v2 8/8] drm/xen: " Ze Huang
2026-07-16  9:28   ` sashiko-bot
2026-07-18 18:50     ` Ze Huang

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=DK1VC0BQUHEL.3R0D087PCM7KY@oss.qualcomm.com \
    --to=ze.huang@oss.qualcomm.com \
    --cc=Frank.Li@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=imx@lists.linux.dev \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox