linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fbdev: core: fix ubsan warning in pixel_to_pat
@ 2025-08-21  2:42 Zsolt Kajtar
  2025-08-24 15:38 ` Helge Deller
  0 siblings, 1 reply; 2+ messages in thread
From: Zsolt Kajtar @ 2025-08-21  2:42 UTC (permalink / raw)
  To: linux-fbdev, dri-devel; +Cc: Zsolt Kajtar

It could be triggered on 32 bit big endian machines at 32 bpp in the
pattern realignment. In this case just return early as the result is
an identity.

Signed-off-by: Zsolt Kajtar <soci@c64.rulez.org>
---
 drivers/video/fbdev/core/fb_fillrect.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/video/fbdev/core/fb_fillrect.h b/drivers/video/fbdev/core/fb_fillrect.h
index 66042e534..f366670a5 100644
--- a/drivers/video/fbdev/core/fb_fillrect.h
+++ b/drivers/video/fbdev/core/fb_fillrect.h
@@ -92,8 +92,7 @@ static unsigned long pixel_to_pat(int bpp, u32 color)
 		pattern = pattern | pattern << bpp;
 		break;
 	default:
-		pattern = color;
-		break;
+		return color;
 	}
 #ifndef __LITTLE_ENDIAN
 	pattern <<= (BITS_PER_LONG % bpp);
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] fbdev: core: fix ubsan warning in pixel_to_pat
  2025-08-21  2:42 [PATCH] fbdev: core: fix ubsan warning in pixel_to_pat Zsolt Kajtar
@ 2025-08-24 15:38 ` Helge Deller
  0 siblings, 0 replies; 2+ messages in thread
From: Helge Deller @ 2025-08-24 15:38 UTC (permalink / raw)
  To: Zsolt Kajtar, linux-fbdev, dri-devel

On 8/21/25 04:42, Zsolt Kajtar wrote:
> It could be triggered on 32 bit big endian machines at 32 bpp in the
> pattern realignment. In this case just return early as the result is
> an identity.
> 
> Signed-off-by: Zsolt Kajtar <soci@c64.rulez.org>
> ---
>   drivers/video/fbdev/core/fb_fillrect.h | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)

applied.

Thanks!
Helge

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-08-24 15:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-21  2:42 [PATCH] fbdev: core: fix ubsan warning in pixel_to_pat Zsolt Kajtar
2025-08-24 15:38 ` Helge Deller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).