:: commit f0ee314bf28f6441bff71b4655976a78f740d7a5

Mintsuki <mintsuki@protonmail.com> — 2026-01-04 16:12

parents: 0b17ff4a98

lib/fb: Fix byte width calculation in fb_clear() default case

diff --git a/common/lib/fb.c b/common/lib/fb.c
index 0db34500..05096b99 100644
--- a/common/lib/fb.c
+++ b/common/lib/fb.c
@@ -54,7 +54,8 @@ void fb_clear(struct fb_info *fb) {
             default: {
                 uint8_t *fbp = (void *)(uintptr_t)fb->framebuffer_addr;
                 size_t row = y * fb->framebuffer_pitch;
-                for (size_t x = 0; x < fb->framebuffer_width * fb->framebuffer_bpp; x++) {
+                size_t row_bytes = fb->framebuffer_width * (fb->framebuffer_bpp / 8);
+                for (size_t x = 0; x < row_bytes; x++) {
                     fbp[row + x] = 0;
                 }
                 break;
tab: 248 wrap: offon