mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jocelyn Falempe <jfalempe@redhat.com>
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>,
	Jocelyn Falempe <jfalempe@redhat.com>,
	Javier Martinez Canillas <javierm@redhat.com>,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org
Cc: stable@vger.kernel.org
Subject: [PATCH 1/6] drm/panic: Fix drawing the logo on a small narrow screen
Date: Thu,  9 Oct 2025 14:24:48 +0200	[thread overview]
Message-ID: <20251009122955.562888-2-jfalempe@redhat.com> (raw)
In-Reply-To: <20251009122955.562888-1-jfalempe@redhat.com>

If the logo width is bigger than the framebuffer width, and the
height is big enough to hold the logo and the message, it will draw
at x coordinate that are higher than the width, and ends up in a
corrupted image.

Fixes: 4b570ac2eb54 ("drm/rect: Add drm_rect_overlap()")
Signed-off-by: Jocelyn Falempe <jfalempe@redhat.com>
---
 drivers/gpu/drm/drm_panic.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/drm_panic.c b/drivers/gpu/drm/drm_panic.c
index 1d6312fa1429..23ba791c6131 100644
--- a/drivers/gpu/drm/drm_panic.c
+++ b/drivers/gpu/drm/drm_panic.c
@@ -429,6 +429,9 @@ static void drm_panic_logo_rect(struct drm_rect *rect, const struct font_desc *f
 static void drm_panic_logo_draw(struct drm_scanout_buffer *sb, struct drm_rect *rect,
 				const struct font_desc *font, u32 fg_color)
 {
+	if (rect->x2 > sb->width || rect->y2 > sb->height)
+		return;
+
 	if (logo_mono)
 		drm_panic_blit(sb, rect, logo_mono->data,
 			       DIV_ROUND_UP(drm_rect_width(rect), 8), 1, fg_color);
-- 
2.51.0


  reply	other threads:[~2025-10-09 12:30 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-09 12:24 [PATCH 0/6] drm/panic: Fixes found with kunit Jocelyn Falempe
2025-10-09 12:24 ` Jocelyn Falempe [this message]
2025-10-14  7:32   ` [PATCH 1/6] drm/panic: Fix drawing the logo on a small narrow screen Javier Martinez Canillas
2025-10-09 12:24 ` [PATCH 2/6] drm/panic: Fix overlap between qr code and logo Jocelyn Falempe
2025-10-14  7:32   ` Javier Martinez Canillas
2025-10-09 12:24 ` [PATCH 3/6] drm/panic: Fix qr_code, ensure vmargin is positive Jocelyn Falempe
2025-10-14  7:34   ` Javier Martinez Canillas
2025-10-09 12:24 ` [PATCH 4/6] drm/panic: Fix kmsg text drawing rectangle Jocelyn Falempe
2025-10-14  7:35   ` Javier Martinez Canillas
2025-10-09 12:24 ` [PATCH 5/6] drm/panic: Fix divide by 0 if the screen width < font width Jocelyn Falempe
2025-10-14  7:36   ` Javier Martinez Canillas
2025-10-09 12:24 ` [PATCH 6/6] drm/panic: Fix 24bit pixel crossing page boundaries Jocelyn Falempe
2025-10-14  7:37   ` Javier Martinez Canillas
2025-10-21  9:35 ` [PATCH 0/6] drm/panic: Fixes found with kunit Jocelyn Falempe
2025-10-21 11:24   ` Thomas Zimmermann
2025-10-21 12:32     ` 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=20251009122955.562888-2-jfalempe@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=simona@ffwll.ch \
    --cc=stable@vger.kernel.org \
    --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®