Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 28 Apr 2026 18:56:00 +0000
From:      Ahmad Khalifa <vexeduxr@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 1a8343a00a16 - stable/15 - vt_core: make sure the driver's functions exist
Message-ID:  <69f102c0.26f4e.7e62fe81@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch stable/15 has been updated by vexeduxr:

URL: https://cgit.FreeBSD.org/src/commit/?id=1a8343a00a16a74c58eee2e74e22aee5cd347ae2

commit 1a8343a00a16a74c58eee2e74e22aee5cd347ae2
Author:     Ahmad Khalifa <vexeduxr@FreeBSD.org>
AuthorDate: 2026-04-20 20:15:00 +0000
Commit:     Ahmad Khalifa <vexeduxr@FreeBSD.org>
CommitDate: 2026-04-28 16:47:11 +0000

    vt_core: make sure the driver's functions exist
    
    These are NULL if they're not implemented. Make sure all the functions
    we need are there before doing anything.
    
    Also invert the first if statment to lessen the indentation a bit.
    
    Reported by:    Quentin Thébault <quentin.thebault@defenso.fr>
    MFC after:      3 days
    
    (cherry picked from commit d1854272b646306de6546f8e5702e8072051d7f6)
---
 sys/dev/vt/vt_core.c | 59 ++++++++++++++++++++++++++++++----------------------
 1 file changed, 34 insertions(+), 25 deletions(-)

diff --git a/sys/dev/vt/vt_core.c b/sys/dev/vt/vt_core.c
index 33bbe65cb678..2015d982a560 100644
--- a/sys/dev/vt/vt_core.c
+++ b/sys/dev/vt/vt_core.c
@@ -1682,32 +1682,41 @@ vtterm_splash(struct vt_device *vd)
 	uintptr_t image;
 	vt_axis_t top, left;
 
-	if (!(vd->vd_flags & VDF_TEXTMODE) && (boothowto & RB_MUTE)) {
-		if (rebooting == 1) {
-			si = MD_FETCH(preload_kmdp, MODINFOMD_SHTDWNSPLASH, struct splash_info *);
-			vd->vd_driver->vd_blank(vd, TC_BLACK);
-		} else {
-			si = MD_FETCH(preload_kmdp, MODINFOMD_SPLASH, struct splash_info *);
-		}
-		if (si == NULL) {
-			top = (vd->vd_height - vt_logo_height) / 2;
-			left = (vd->vd_width - vt_logo_width) / 2;
-			vd->vd_driver->vd_bitblt_bmp(vd, vd->vd_curwindow,
-			    vt_logo_image, NULL, vt_logo_width, vt_logo_height,
-			    left, top, TC_WHITE, TC_BLACK);
-		} else {
-			if (si->si_depth != 4)
-				return;
-			image = (uintptr_t)si + sizeof(struct splash_info);
-			image = roundup2(image, 8);
-			top = (vd->vd_height - si->si_height) / 2;
-			left = (vd->vd_width - si->si_width) / 2;
-			vd->vd_driver->vd_bitblt_argb(vd, vd->vd_curwindow,
-			    (unsigned char *)image, si->si_width, si->si_height,
-			    left, top);
-		}
-		vd->vd_flags |= VDF_SPLASH;
+	if ((vd->vd_flags & VDF_TEXTMODE) != 0 || (boothowto & RB_MUTE) == 0)
+		return;
+
+	si = MD_FETCH(preload_kmdp, rebooting == 1 ? MODINFOMD_SHTDWNSPLASH :
+	    MODINFOMD_SPLASH, struct splash_info *);
+	if (si == NULL) {
+		if (vd->vd_driver->vd_bitblt_bmp == NULL)
+			return;
+	} else if (vd->vd_driver->vd_bitblt_argb == NULL)
+		return;
+
+	if (rebooting == 1) {
+		if (vd->vd_driver->vd_blank == NULL)
+			return;
+		vd->vd_driver->vd_blank(vd, TC_BLACK);
 	}
+
+	if (si == NULL) {
+		top = (vd->vd_height - vt_logo_height) / 2;
+		left = (vd->vd_width - vt_logo_width) / 2;
+		vd->vd_driver->vd_bitblt_bmp(vd,
+		    vd->vd_curwindow, vt_logo_image, NULL, vt_logo_width,
+		    vt_logo_height, left, top, TC_WHITE, TC_BLACK);
+	} else {
+		if (si->si_depth != 4)
+			return;
+		image = (uintptr_t)si + sizeof(struct splash_info);
+		image = roundup2(image, 8);
+		top = (vd->vd_height - si->si_height) / 2;
+		left = (vd->vd_width - si->si_width) / 2;
+		vd->vd_driver->vd_bitblt_argb(vd, vd->vd_curwindow,
+		    (unsigned char *)image, si->si_width, si->si_height,
+		    left, top);
+	}
+	vd->vd_flags |= VDF_SPLASH;
 }
 #endif
 


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69f102c0.26f4e.7e62fe81>