fbsplash: use virtual y size in mmap size calculations
authorTimo Teräs <timo.teras@iki.fi>
Mon, 26 Oct 2015 07:40:31 +0000 (09:40 +0200)
committerDenys Vlasenko <vda.linux@googlemail.com>
Tue, 27 Oct 2015 20:32:00 +0000 (21:32 +0100)
The virtual y can be larger - and we can be even writing there since
we are taking into account the y offset. Avoids possible crash.
But use it only if set, seems it is not set if virtual area is not
allocated (though, often fbcon allocates some scrollback area).

Signed-off-by: Timo Teräs <timo.teras@iki.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
miscutils/fbsplash.c

index 77033c258cff354bf30ec331583676381affa477..9557c41dba6525fc10bfb733e90c5787f17fc502 100644 (file)
@@ -150,7 +150,7 @@ static void fb_open(const char *strfb_device)
 
        // map the device in memory
        G.addr = mmap(NULL,
-                       G.scr_var.yres * G.scr_fix.line_length,
+                       (G.scr_var.yres_virtual ?: G.scr_var.yres) * G.scr_fix.line_length,
                        PROT_WRITE, MAP_SHARED, fbfd, 0);
        if (G.addr == MAP_FAILED)
                bb_perror_msg_and_die("mmap");