mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Arun Iyengar via B4 Relay <devnull+aiyengar1990.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,
	 Jani Nikula <jani.nikula@linux.intel.com>,
	 Arun Iyengar <aiyengar1990@gmail.com>
Subject: [PATCH v3] drm/debugfs: Accept "reset" with a trailing newline in edid_override
Date: Thu, 19 Nov 2026 04:39:18 +0000	[thread overview]
Message-ID: <20261119-drm-debugfs-edid-reset-v3-1-1cc341d0cf41@gmail.com> (raw)

From: Arun Iyengar <aiyengar1990@gmail.com>

Writing "reset" to edid_override removes the override only for exactly
those five bytes, so "echo reset > edid_override" fails with -EINVAL.

Compare with sysfs_streq() on a NUL-terminated copy.

Suggested-by: Jani Nikula <jani.nikula@linux.intel.com>
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
Tested on an Orange Pi 5 (7.3-based kernel with KASAN) on its DP
connector: setting and reading back the EDID, both reset forms, and
malformed and oversized writes (rejected, override unchanged).

Developed with Claude (Anthropic), which wrote the code and the commit
message. I reviewed every change.
---
Changes in v3:
- Drop the unrelated length check (Jani Nikula)
- Link to v2: https://patch.msgid.link/20261113-drm-debugfs-edid-reset-v2-1-07939ebe7a8b@gmail.com
---
 drivers/gpu/drm/drm_debugfs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c
index a72f9723d3a9..77b22730d091 100644
--- a/drivers/gpu/drm/drm_debugfs.c
+++ b/drivers/gpu/drm/drm_debugfs.c
@@ -565,11 +565,11 @@ static ssize_t edid_write(struct file *file, const char __user *ubuf,
 	char *buf;
 	int ret;
 
-	buf = memdup_user(ubuf, len);
+	buf = memdup_user_nul(ubuf, len);
 	if (IS_ERR(buf))
 		return PTR_ERR(buf);
 
-	if (len == 5 && !strncmp(buf, "reset", 5))
+	if (sysfs_streq(buf, "reset"))
 		ret = drm_edid_override_reset(connector);
 	else
 		ret = drm_edid_override_set(connector, buf, len);

---
base-commit: 467ac0b56aebc804360f276feffbc9032c265a6e
change-id: 20261110-drm-debugfs-edid-reset-0504a20c67d1

Best regards,
--  
Arun Iyengar <aiyengar1990@gmail.com>



                 reply	other threads:[~2026-11-19  4:39 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=20261119-drm-debugfs-edid-reset-v3-1-1cc341d0cf41@gmail.com \
    --to=devnull+aiyengar1990.gmail.com@kernel.org \
    --cc=airlied@gmail.com \
    --cc=aiyengar1990@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=simona@ffwll.ch \
    --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®