[PATCH] fbcon: Check font dimension limits
Jiri Slaby
jirislaby at kernel.org
Thu Jan 26 09:08:07 UTC 2023
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
More information about the dri-devel
mailing list