Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 30 Dec 2017 20:23:14 +0000 (UTC)
From:      Nathan Whitehorn <nwhitehorn@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r327387 - head/sys/dev/vt/hw/ofwfb
Message-ID:  <201712302023.vBUKNEOp016149@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201712302023.vBUKNEOp016149>