> Greetings!
> 
> Getting this UBSAN hit on my PowerMac G4 DP with kernel 6.17-rc2:
> 
> [...]
> Console: switching to colour frame buffer device 240x67
> ------------[ cut here ]------------
> UBSAN: shift-out-of-bounds in drivers/video/fbdev/core/fb_fillrect.h:100:21
> shift exponent 32 is too large for 32-bit type 'unsigned long'

Thanks for reporting!

> I guess this would be a problem on other 32bit arches too?

It's only on 32 bit big endian. I don't have UBSAN for MIPS on my setup
so haven't noticed it.

#ifndef __LITTLE_ENDIAN
        pattern <<= (BITS_PER_LONG % bpp);
        pattern |= pattern >> bpp;          <-
#endif

In the 32 BPP case the result is identical in both the no shift and zero
result implementations.

I've patched it by skipping this realignment as it's only needed if the
BPP is smaller than the word length.

-- 
                                                    -soci-

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

Reply via email to