]> Gentwo Git Trees - linux/.git/commitdiff
fbdev: core: Fix ubsan warning in pixel_to_pat
authorZsolt Kajtar <soci@c64.rulez.org>
Thu, 21 Aug 2025 02:42:48 +0000 (04:42 +0200)
committerHelge Deller <deller@gmx.de>
Tue, 30 Sep 2025 21:21:34 +0000 (23:21 +0200)
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>
Signed-off-by: Helge Deller <deller@gmx.de>
drivers/video/fbdev/core/fb_fillrect.h

index 66042e534de77168d044b7ba34cb72db6b1a1d12..f366670a53af824fb31770f194fa3290817a4a35 100644 (file)
@@ -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);