From nobody Fri Jul 01 11:37:19 2022 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 718B58B0D85; Fri, 1 Jul 2022 11:37:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4LZCq32c8tz3nTP; Fri, 1 Jul 2022 11:37:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1656675439; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=s0FBNEbUQaU5ayiKGmCoFGrGpjeAug07IncjhUllQLQ=; b=WlgAf2aFz0EgneSN42LqRIANgn/pJPFoBwkMr2kSD9Y24EsZTbx3pVjNOilUury+R5VAsb k+pRn81VPAsfVuHAPZn9IdEBYxhRB/IvsWEK9lFqyF6MqBuUqt0h875gKITUDF5W3sGtDS gsftkB2wFNzOsr0Gh0JfxCj4H7BAzBJmUUMugzIlrzMQ1lHcZd32Ma97pbP3JCW/toLTKV 2+L6eOIr2j4+OGgYXp8s+kPtTJGggzpffkZIO+ZBU6lArkb9KaGdeS7YjvsUVF0V7ArkRK vgA9RgOG3rflGGopqpnm5YtBOuZCQGqWY4rxAMA2GGlbEFThPaJt9NnTkUErmw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3943A1AC12; Fri, 1 Jul 2022 11:37:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 261BbJGc085727; Fri, 1 Jul 2022 11:37:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 261BbJFm085726; Fri, 1 Jul 2022 11:37:19 GMT (envelope-from git) Date: Fri, 1 Jul 2022 11:37:19 GMT Message-Id: <202207011137.261BbJFm085726@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marcin Wojtas Subject: git: 1323f0aa9cb0 - main - stand/uboot: setup archsw before probing devices List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mw X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1323f0aa9cb0392d2946226bd76f14463e875a60 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1656675439; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=s0FBNEbUQaU5ayiKGmCoFGrGpjeAug07IncjhUllQLQ=; b=PMhrjY4nWA4/+QW95f28x+iqAPkTOxiwaqZ64aUcaJ44qlEc/EiI40FV/SizVldMZQRv1p mxyjcuMpkQr51vjJOsCzgNZkjZIh8VmOb8w2NGT+ZfAP/wDhs8Qzn61nByQhbWEn6sOyV1 ZTaEPXpDYGFfqujpfVb8V2MT1J35RdEBbhfDf5PLEaYZNo8EgI3eErnbiBS3Qb4Hxgj3ou kJjjO/ioVIpwJBcZC3ngwL1bRcgzQGUzIXDqiEmh4qEyJFc/eNTub4AVOqjYOB7l5YURB8 oY+bEHpW2L9trbKL9pGYjikEjErWeLpRnwrU5172fP+hqVqNlByVldozb6FWYQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1656675439; a=rsa-sha256; cv=none; b=kh3vAQopl73X6yqbPuXbxyMNetvIjHIRaqIPWb/JrSgCiDfclGhVZBPz/3HRQ7XmQT3KOA konFE2Vo5q+PQKDB7lQd27+uZyCjQVdUScNn1uL9G6ZBJKPr+2Ph73J2K1OIwtUSHyKNCo 6ksNUI0N9W2gJfpUHEWy3lxON82vSEv0DPpe0dEvokD3zIw7u3WCCemSahTYpVVT3XnKWa tuZuaHcexOo+2MJEvCa2/UICCMjzTrO8CkIBBRqnsDPsv2rvN02fGKFWGG5m3RuH/rM7Zk Nj7cG8AUDKyQmFEonwBUCnk+VW7PXowv2Py5lrIm1UezrkiuAShgxsNOcd0rUg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mw: URL: https://cgit.FreeBSD.org/src/commit/?id=1323f0aa9cb0392d2946226bd76f14463e875a60 commit 1323f0aa9cb0392d2946226bd76f14463e875a60 Author: Albert Jakiela AuthorDate: 2022-06-28 15:28:35 +0000 Commit: Marcin Wojtas CommitDate: 2022-07-01 11:36:41 +0000 stand/uboot: setup archsw before probing devices In some cases ubldr would try to mount a disk device before the archsw struct was filled with functions pointers. This would result in a NULL pointer derefrence of the arch_getdev field. Fix that filling the archsw functions earlier. Note that this matches the EFI behavoiur. Reviewed by: imp, mw Sponsored by: Stormshield Obtained from: Semihalf MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D35670 --- stand/uboot/main.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/stand/uboot/main.c b/stand/uboot/main.c index 85ddf5db1f90..6648dc607c11 100644 --- a/stand/uboot/main.c +++ b/stand/uboot/main.c @@ -475,6 +475,13 @@ main(int argc, char **argv) meminfo(); + archsw.arch_loadaddr = uboot_loadaddr; + archsw.arch_getdev = uboot_getdev; + archsw.arch_copyin = uboot_copyin; + archsw.arch_copyout = uboot_copyout; + archsw.arch_readin = uboot_readin; + archsw.arch_autoload = uboot_autoload; + /* Set up currdev variable to have hooks in place. */ env_setenv("currdev", EV_VOLATILE, "", uboot_setcurrdev, env_nounset); @@ -538,13 +545,6 @@ do_interact: setenv("usefdt", "1", 1); #endif - archsw.arch_loadaddr = uboot_loadaddr; - archsw.arch_getdev = uboot_getdev; - archsw.arch_copyin = uboot_copyin; - archsw.arch_copyout = uboot_copyout; - archsw.arch_readin = uboot_readin; - archsw.arch_autoload = uboot_autoload; - interact(); /* doesn't return */ return (0);