svn commit: r336554 - head/sys/dev/vt/hw/ofwfb
Justin Hibbits
jhibbits at FreeBSD.org
Fri Jul 20 16:08:15 UTC 2018
Author: jhibbits
Date: Fri Jul 20 16:08:14 2018
New Revision: 336554
URL: https://svnweb.freebsd.org/changeset/base/336554
Log:
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().
Modified:
head/sys/dev/vt/hw/ofwfb/ofwfb.c
Modified: head/sys/dev/vt/hw/ofwfb/ofwfb.c
==============================================================================
--- head/sys/dev/vt/hw/ofwfb/ofwfb.c Fri Jul 20 16:06:44 2018 (r336553)
+++ head/sys/dev/vt/hw/ofwfb/ofwfb.c Fri Jul 20 16:08:14 2018 (r336554)
@@ -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
More information about the svn-src-head
mailing list