[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <edcf26d4-64a0-04ea-435c-17d9efde7dd9@kernel.org>
Date: Thu, 26 Jan 2023 10:08:07 +0100
From: Jiri Slaby <jirislaby@...nel.org>
To: Greg KH <gregkh@...uxfoundation.org>,
Samuel Thibault <samuel.thibault@...-lyon.org>
Cc: 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
On 26. 01. 23, 8:43, Greg KH wrote:
>> --- 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))))
>
> Are you sure this is still needed with the above check added? If so,
> why? What is the difference in the compiled code?
For font->{width,height} == 32, definitely. IMO, 1 << 31 is undefined as
1 << 31 cannot be represented by an (signed) int.
--
js
suse labs
Powered by blists - more mailing lists