Skip to content

Commit 74b86d3

Browse files
peda-rgregkh
authored andcommitted
fbdev: fbmem: behave better with small rotated displays and many CPUs
[ Upstream commit f75df8d4b4fabfad7e3cba2debfad12741c6fde7 ] Blitting an image with "negative" offsets is not working since there is no clipping. It hopefully just crashes. For the bootup logo, there is protection so that blitting does not happen as the image is drawn further and further to the right (ROTATE_UR) or further and further down (ROTATE_CW). There is however no protection when drawing in the opposite directions (ROTATE_UD and ROTATE_CCW). Add back this protection. The regression is 20-odd years old but the mindless warning-killing mentality displayed in commit 34bdb66 ("fbdev: fbmem: remove positive test on unsigned values") is also to blame, methinks. Fixes: 448d479 ("fbdev: fb_do_show_logo() updates") Signed-off-by: Peter Rosin <peda@axentia.se> Cc: Tomi Valkeinen <tomi.valkeinen@ti.com> Cc: Fabian Frederick <ffrederick@users.sourceforge.net> Cc: Geert Uytterhoeven <geert+renesas@glider.be> cc: Geoff Levand <geoff@infradead.org> Cc: James Simmons <jsimmons@users.sf.net> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 36ef751 commit 74b86d3

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

drivers/video/fbdev/core/fbmem.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,9 @@ static void fb_do_show_logo(struct fb_info *info, struct fb_image *image,
435435
image->dx += image->width + 8;
436436
}
437437
} else if (rotate == FB_ROTATE_UD) {
438-
for (x = 0; x < num; x++) {
438+
u32 dx = image->dx;
439+
440+
for (x = 0; x < num && image->dx <= dx; x++) {
439441
info->fbops->fb_imageblit(info, image);
440442
image->dx -= image->width + 8;
441443
}
@@ -447,7 +449,9 @@ static void fb_do_show_logo(struct fb_info *info, struct fb_image *image,
447449
image->dy += image->height + 8;
448450
}
449451
} else if (rotate == FB_ROTATE_CCW) {
450-
for (x = 0; x < num; x++) {
452+
u32 dy = image->dy;
453+
454+
for (x = 0; x < num && image->dy <= dy; x++) {
451455
info->fbops->fb_imageblit(info, image);
452456
image->dy -= image->height + 8;
453457
}

0 commit comments

Comments
 (0)