From: TAKANO Mitsuhiro via B4 Relay <devnull+takano32.gmail.com@kernel.org>
To: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@gmail.com>,
Simona Vetter <simona@ffwll.ch>
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
TAKANO Mitsuhiro <takano32@gmail.com>
Subject: [PATCH] drm/scdc-helper: check state for NULL before taking state->scdc
Date: Sat, 28 Nov 2026 22:29:12 +0000 [thread overview]
Message-ID: <20261128-b4-drm-scdc-null-check-v1-1-a8324021331f@gmail.com> (raw)
From: TAKANO Mitsuhiro <takano32@gmail.com>
In drm_scdc_read_state(), buf is initialized to state->scdc before state
is checked for NULL. Evaluating state->scdc when state is NULL is
undefined behavior and allows the compiler to assume state is non-NULL.
Assign buf after verifying that state and connector are non-NULL.
Fixes: 6c5121962ec0 ("drm/scdc-helper: Add scdc_status debugfs entry")
Signed-off-by: TAKANO Mitsuhiro <takano32@gmail.com>
---
Verification: compile-tested on x86_64 with CONFIG_DRM_DISPLAY_HELPER=m
and CONFIG_DRM_DISPLAY_HDMI_HELPER=y (make W=1
drivers/gpu/drm/display/drm_scdc_helper.o; 0 warnings) and checked with
scripts/checkpatch.pl --strict. Checked against linux-next (next-20261127)
and lore.kernel.org for duplicates. Not runtime-tested on HDMI hardware.
The change and the changelog text were produced with an AI coding
assistant (Gemini) working from the tree; I reviewed the diff and the
reasoning, and I am responsible for the submission.
---
drivers/gpu/drm/display/drm_scdc_helper.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/display/drm_scdc_helper.c b/drivers/gpu/drm/display/drm_scdc_helper.c
index 74388481f..9a0300092 100644
--- a/drivers/gpu/drm/display/drm_scdc_helper.c
+++ b/drivers/gpu/drm/display/drm_scdc_helper.c
@@ -428,13 +428,14 @@ int drm_scdc_read_state(struct drm_connector *connector, struct drm_scdc_state *
{
struct i2c_adapter *ddc;
struct drm_scdc *scdc;
- u8 *buf = state->scdc;
+ u8 *buf;
int num_lanes;
int ret;
if (!state || !connector)
return -ENODEV;
+ buf = state->scdc;
scdc = &connector->display_info.hdmi.scdc;
ddc = connector->ddc;
---
base-commit: f93eb7cfc4bfa5d46340f360873726e3e77f2365
change-id: 20261128-b4-drm-scdc-null-check-8017240e3b9d
Best regards,
--
TAKANO Mitsuhiro <takano32@gmail.com>
reply other threads:[~2026-11-28 22:29 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20261128-b4-drm-scdc-null-check-v1-1-a8324021331f@gmail.com \
--to=devnull+takano32.gmail.com@kernel.org \
--cc=airlied@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=simona@ffwll.ch \
--cc=takano32@gmail.com \
--cc=tzimmermann@suse.de \
/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
all inboxes | Powered by JetHome®