From owner-svn-src-all@freebsd.org Sat Dec 30 20:23:15 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9C75DEAAA34; Sat, 30 Dec 2017 20:23:15 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 665E56AEEC; Sat, 30 Dec 2017 20:23:15 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vBUKNEEW016150; Sat, 30 Dec 2017 20:23:14 GMT (envelope-from nwhitehorn@FreeBSD.org) Received: (from nwhitehorn@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vBUKNEOp016149; Sat, 30 Dec 2017 20:23:14 GMT (envelope-from nwhitehorn@FreeBSD.org) Message-Id: <201712302023.vBUKNEOp016149@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: nwhitehorn set sender to nwhitehorn@FreeBSD.org using -f From: Nathan Whitehorn Date: Sat, 30 Dec 2017 20:23:14 +0000 (UTC) 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 X-SVN-Group: head X-SVN-Commit-Author: nwhitehorn X-SVN-Commit-Paths: head/sys/dev/vt/hw/ofwfb X-SVN-Commit-Revision: 327387 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Dec 2017 20:23:15 -0000 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