From owner-svn-src-all@freebsd.org Fri Jul 20 16:08:15 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 00019104A98D; Fri, 20 Jul 2018 16:08:14 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A15E8829F4; Fri, 20 Jul 2018 16:08:14 +0000 (UTC) (envelope-from jhibbits@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 824D01265C; Fri, 20 Jul 2018 16:08:14 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6KG8E4R054458; Fri, 20 Jul 2018 16:08:14 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6KG8E6L054457; Fri, 20 Jul 2018 16:08:14 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201807201608.w6KG8E6L054457@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Fri, 20 Jul 2018 16:08:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336554 - head/sys/dev/vt/hw/ofwfb X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/dev/vt/hw/ofwfb X-SVN-Commit-Revision: 336554 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.27 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: Fri, 20 Jul 2018 16:08:15 -0000 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