From: sashiko-bot@kernel.org
To: "Aaron Kling" <webgeek1234@gmail.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 1/2] drm/tegra: Support swapping chroma planes
Date: Thu, 08 Oct 2026 21:09:33 +0000 [thread overview]
Message-ID: <sashiko-outbox-164597@kernel.org> (raw)
In-Reply-To: <20261008-tegra-drm-yvu420-v1-1-dc1c443c00f3@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] drm/tegra: uninitialized swap_uv field in tegra_plane_atomic_duplicate_state
--
commit 7a6701643e457b2ef09eac11050804bd4c35f58d
Author: Aaron Kling <webgeek1234@gmail.com>
drm/tegra: Support swapping chroma planes
The Tegra display controller supports some yuv types, but not their
chroma swapped variants. For example, yuv420 is supported but yvu420 is
not. This can be efficiently worked around by just passing the hardware
said chroma planes backwards. Add a flag to the plane state struct and
handling to both tegradc and nvdisplay paths.
> diff --git a/drivers/gpu/drm/tegra/plane.h b/drivers/gpu/drm/tegra/plane.h
> index e33a581e6490e..dba5f1b254e98 100644
> --- a/drivers/gpu/drm/tegra/plane.h
> +++ b/drivers/gpu/drm/tegra/plane.h
> @@ -49,6 +49,7 @@ struct tegra_plane_state {
> struct tegra_bo_tiling tiling;
> u32 format;
> u32 swap;
> + bool swap_uv;
[Severity: Low]
Does tegra_plane_atomic_duplicate_state() need to copy this new swap_uv field?
In drivers/gpu/drm/tegra/plane.c:tegra_plane_atomic_duplicate_state(), the
state object is allocated without zero-initializing memory, and then
explicitly copies fields like format, swap, and reflect_x:
copy->format = state->format;
copy->swap = state->swap;
copy->reflect_x = state->reflect_x;
copy->reflect_y = state->reflect_y;
Because a corresponding copy->swap_uv = state->swap_uv assignment is omitted,
copy->swap_uv contains uninitialized heap memory. While this is partially
mitigated because tegra_plane_atomic_check() recomputes swap_uv for active
planes, the uninitialized memory persists if the plane is disabled
(!new_plane_state->crtc), which violates the state duplication contract and
could risk undefined behavior if the state is inspected later.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261008-tegra-drm-yvu420-v1-0-dc1c443c00f3@gmail.com?part=1
next prev parent reply other threads:[~2026-10-08 21:09 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-08 20:57 [PATCH 0/2] drm/tegra: Support YVU420 Aaron Kling via B4 Relay
2026-10-08 20:57 ` Aaron Kling
2026-10-08 20:57 ` [PATCH 1/2] drm/tegra: Support swapping chroma planes Aaron Kling via B4 Relay
2026-10-08 20:57 ` Aaron Kling
2026-10-08 21:09 ` sashiko-bot [this message]
2026-10-09 8:59 ` Mikko Perttunen
2026-10-09 9:03 ` Mikko Perttunen
2026-10-08 20:57 ` [PATCH 2/2] drm/tegra: Support YVU420 Aaron Kling via B4 Relay
2026-10-08 20:57 ` Aaron Kling
2026-10-08 21:06 ` 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-164597@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=webgeek1234@gmail.com \
/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.