From: Jocelyn Falempe <jfalempe@redhat.com>
To: oushixiong1025@163.com
Cc: Javier Martinez Canillas <javierm@redhat.com>,
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>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
Shixiong Ou <oushixiong@kylinos.cn>
Subject: Re: [PATCH 1/4] drm/log: Fix out-of-bounds read on empty message length
Date: Wed, 29 Jul 2026 17:16:55 +0200 [thread overview]
Message-ID: <b05568d9-476e-4903-a988-1ff72bcc33b1@redhat.com> (raw)
In-Reply-To: <20260729084520.688087-1-oushixiong1025@163.com>
On 29/07/2026 10:45, oushixiong1025@163.com wrote:
> From: Shixiong Ou <oushixiong@kylinos.cn>
>
> drm_log_draw_kmsg_record() accesses s[len - 1] to strip the trailing
> newline, but len is unsigned int. If len is 0, the subtraction wraps
> to UINT_MAX, causing an out-of-bounds read.
>
> Add an early return when len is 0.
Thanks, for your contribution
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
>
> Signed-off-by: Shixiong Ou <oushixiong@kylinos.cn>
> ---
> drivers/gpu/drm/clients/drm_log.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/gpu/drm/clients/drm_log.c b/drivers/gpu/drm/clients/drm_log.c
> index e3e02c84a4cf..294b3be1a6b3 100644
> --- a/drivers/gpu/drm/clients/drm_log.c
> +++ b/drivers/gpu/drm/clients/drm_log.c
> @@ -162,6 +162,9 @@ static void drm_log_draw_kmsg_record(struct drm_log_scanout *scanout,
> {
> u32 prefix_len = 0;
>
> + if (!len)
> + return;
> +
> if (len > TS_PREFIX_LEN && s[0] == '[' && s[6] == '.' && s[TS_PREFIX_LEN] == ']')
> prefix_len = TS_PREFIX_LEN + 1;
>
next prev parent reply other threads:[~2026-07-29 15:17 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-29 8:45 oushixiong1025
2026-07-29 8:45 ` [PATCH 2/4] drm/log: Fix division by zero when scale module parameter is 0 oushixiong1025
2026-07-29 9:48 ` Jani Nikula
2026-07-29 15:16 ` Jocelyn Falempe [this message]
2026-08-13 14:06 ` [PATCH 1/4] drm/log: Fix out-of-bounds read on empty message length Jocelyn Falempe
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=b05568d9-476e-4903-a988-1ff72bcc33b1@redhat.com \
--to=jfalempe@redhat.com \
--cc=airlied@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=javierm@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=oushixiong1025@163.com \
--cc=oushixiong@kylinos.cn \
--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®