aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/vt
diff options
context:
space:
mode:
authorJustin Hibbits <jhibbits@FreeBSD.org>2018-07-20 16:08:14 +0000
committerJustin Hibbits <jhibbits@FreeBSD.org>2018-07-20 16:08:14 +0000
commit2cc27fc0694270e7fb0d84e6de90a4a6922f831f (patch)
treeb68dd86c0db1c3bb57046759edbe9c5d74de9b7b /sys/dev/vt
parent9b0841ae45eb366b15e842952d7a706e1f41b1bc (diff)
downloadsrc-2cc27fc0694270e7fb0d84e6de90a4a6922f831f.tar.gz
src-2cc27fc0694270e7fb0d84e6de90a4a6922f831f.zip
vt/ofwfb: Check that /chosen/stdout is valid before using it in initialization
The FDT implementation of OF_instance_to_package() backend checks the cross-reference to get the node. On failure, this returns the input handle unchanged. In the case of ofwfb attachment, if /chosen/stdout property does not exist, sc->sc_handle is either garbage or 0, which then gets propagated to node. This will prevent "screen" from being used, resulting in not properly attaching. Correct this by matching the code in ofwfb_probe().
Notes
Notes: svn path=/head/; revision=336554
Diffstat (limited to 'sys/dev/vt')
-rw-r--r--sys/dev/vt/hw/ofwfb/ofwfb.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/dev/vt/hw/ofwfb/ofwfb.c b/sys/dev/vt/hw/ofwfb/ofwfb.c
index db52f92cd27b..73fcb9e0d65f 100644
--- a/sys/dev/vt/hw/ofwfb/ofwfb.c
+++ b/sys/dev/vt/hw/ofwfb/ofwfb.c
@@ -370,9 +370,11 @@ ofwfb_init(struct vt_device *vd)
/* Initialize softc */
vd->vd_softc = sc = &ofwfb_conssoftc;
+ node = -1;
chosen = OF_finddevice("/chosen");
- OF_getprop(chosen, "stdout", &sc->sc_handle, sizeof(ihandle_t));
- node = OF_instance_to_package(sc->sc_handle);
+ if (OF_getprop(chosen, "stdout", &sc->sc_handle,
+ sizeof(ihandle_t)) == sizeof(ihandle_t))
+ node = OF_instance_to_package(sc->sc_handle);
if (node == -1) {
/*
* The "/chosen/stdout" does not exist try