svn commit: r327387 - head/sys/dev/vt/hw/ofwfb

Nathan Whitehorn nwhitehorn at FreeBSD.org
Sat Dec 30 20:23:15 UTC 2017


Author: nwhitehorn
Date: Sat Dec 30 20:23:14 2017
New Revision: 327387
URL: https://svnweb.freebsd.org/changeset/base/327387

Log:
  Check more aggressively for whether the desired properties actually exist.
  If they don't, the code would look up some random part of the device tree
  and seize the console inappropriately.
  
  MFC after:	2 weeks

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	Sat Dec 30 19:49:40 2017	(r327386)
+++ head/sys/dev/vt/hw/ofwfb/ofwfb.c	Sat Dec 30 20:23:14 2017	(r327387)
@@ -94,8 +94,13 @@ ofwfb_probe(struct vt_device *vd)
 	char type[64];
 
 	chosen = OF_finddevice("/chosen");
-	OF_getprop(chosen, "stdout", &stdout, sizeof(stdout));
-	node = OF_instance_to_package(stdout);
+	if (chosen == -1)
+		return (CN_DEAD);
+
+	node = -1;
+	if (OF_getprop(chosen, "stdout", &stdout, sizeof(stdout)) ==
+	    sizeof(stdout))
+		node = OF_instance_to_package(stdout);
 	if (node == -1) {
 		/*
 		 * The "/chosen/stdout" does not exist try


More information about the svn-src-head mailing list