From: Jani Nikula <jani.nikula@linux.intel.com>
To: Arun Iyengar via B4 Relay
<devnull+aiyengar1990.gmail.com@kernel.org>,
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,
Arun Iyengar <aiyengar1990@gmail.com>
Subject: Re: [PATCH v2] drm/debugfs: Accept "reset" with a trailing newline in edid_override
Date: Mon, 16 Nov 2026 12:50:48 +0200 [thread overview]
Message-ID: <79235528599da1ab5445fd8fcdc529c182eacf33@intel.com> (raw)
In-Reply-To: <20261113-drm-debugfs-edid-reset-v2-1-07939ebe7a8b@gmail.com>
On Fri, 13 Nov 2026, Arun Iyengar via B4 Relay <devnull+aiyengar1990.gmail.com@kernel.org> wrote:
> From: Arun Iyengar <aiyengar1990@gmail.com>
>
> Writing "reset" to edid_override only removes the override when exactly
> those five bytes are written, so "echo reset > edid_override" fails with
> -EINVAL and leaves the override in place.
>
> Compare with sysfs_streq() on a NUL-terminated copy, and reject writes
> larger than the largest possible EDID (256 blocks) before copying,
> so that the size of the copy is bounded.
>
> Suggested-by: Jani Nikula <jani.nikula@linux.intel.com>
> Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
> ---
> Tested on an Orange Pi 5 (RK3588S) with this patch on a 7.3 based
> kernel: "echo reset" and "printf reset" both remove an override, an EDID
> override round trip still works, and garbage or oversized writes fail
> with -EINVAL.
>
> Developed with Claude (Anthropic), which wrote the code and the commit
> message. I reviewed and tested it.
> ---
> Changes in v2:
> - Use memdup_user_nul() and sysfs_streq() (Jani Nikula)
> - Reject writes larger than 256 EDID blocks before copying
> - Shorter commit message
> - Link to v1: https://patch.msgid.link/20261112-drm-debugfs-edid-reset-v1-1-4cd19d83cd22@gmail.com
> ---
> drivers/gpu/drm/drm_debugfs.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c
> index a72f9723d3a9..7c39c8ed3984 100644
> --- a/drivers/gpu/drm/drm_debugfs.c
> +++ b/drivers/gpu/drm/drm_debugfs.c
> @@ -565,11 +565,15 @@ static ssize_t edid_write(struct file *file, const char __user *ubuf,
> char *buf;
> int ret;
>
> - buf = memdup_user(ubuf, len);
> + /* An EDID has at most 256 blocks */
> + if (len > 256 * EDID_LENGTH)
> + return -EINVAL;
This is an unrelated change nobody asked for, and it diverges from a
review I tried to converge by presenting a clean hand-written solution
that the LLM didn't come up with on its own.
BR,
Jani.
> +
> + 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: cb0a63f0c96e8ecb90199eeb99cc2a7fcfa703d4
> change-id: 20261110-drm-debugfs-edid-reset-0504a20c67d1
>
> Best regards,
> --
> Arun Iyengar <aiyengar1990@gmail.com>
>
>
--
Jani Nikula, Intel
prev parent reply other threads:[~2026-11-16 10:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-13 21:27 [PATCH v2] drm/debugfs: Accept "reset" with a trailing newline in edid_override Arun Iyengar
2026-11-13 21:27 ` Arun Iyengar via B4 Relay
2026-11-16 10:50 ` Jani Nikula [this message]
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=79235528599da1ab5445fd8fcdc529c182eacf33@intel.com \
--to=jani.nikula@linux.intel.com \
--cc=airlied@gmail.com \
--cc=aiyengar1990@gmail.com \
--cc=devnull+aiyengar1990.gmail.com@kernel.org \
--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=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 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.