[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230129150433.gmdmger2ah63nsg7@begin>
Date: Sun, 29 Jan 2023 16:04:33 +0100
From: Samuel Thibault <samuel.thibault@...-lyon.org>
To: Jiri Slaby <jirislaby@...nel.org>
Cc: gregkh@...uxfoundation.org, Daniel Vetter <daniel@...ll.ch>,
Helge Deller <deller@....de>, linux-fbdev@...r.kernel.org,
dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org,
stable@...r.kernel.org,
Sanan Hasanov <sanan.hasanov@...ghts.ucf.edu>
Subject: Re: [PATCH] fbcon: Check font dimension limits
Jiri Slaby, le jeu. 26 janv. 2023 10:02:55 +0100, a ecrit:
> On 26. 01. 23, 1:49, Samuel Thibault wrote:
> > Index: linux-6.0/drivers/video/fbdev/core/fbcon.c
> > ===================================================================
> > --- linux-6.0.orig/drivers/video/fbdev/core/fbcon.c
> > +++ linux-6.0/drivers/video/fbdev/core/fbcon.c
> > @@ -2489,9 +2489,12 @@ static int fbcon_set_font(struct vc_data
> > h > FBCON_SWAP(info->var.rotate, info->var.yres, info->var.xres))
> > return -EINVAL;
> > + if (font->width > 32 || font->height > 32)
> > + return -EINVAL;
> > +
> > /* Make sure drawing engine can handle the font */
> > - if (!(info->pixmap.blit_x & (1 << (font->width - 1))) ||
> > - !(info->pixmap.blit_y & (1 << (font->height - 1))))
> > + if (!(info->pixmap.blit_x & (1U << (font->width - 1))) ||
> > + !(info->pixmap.blit_y & (1U << (font->height - 1))))
>
> So use BIT() properly then? That should be used in all these shifts anyway.
> Exactly to avoid UB.
Right, I'll use that in next version.
Samuel
Powered by blists - more mailing lists