From nobody Tue Jul 19 09:57:52 2022 X-Original-To: dev-commits-src-all@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 4LnDm06ftvz4WvYV; Tue, 19 Jul 2022 09:57:52 +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 4LnDm064b1z45ps; Tue, 19 Jul 2022 09:57:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1658224672; 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=cgJV+0Ag4BJ0u/Rm6M0MCGMEg/teetbWTXQDgkMMGQA=; b=q/ZNd7VcdXvKM6tJH9jcF+/oA9+07bNZ8bLWZ5fSvzYsoPOGmAvxLl+/l4touHMNiF59W2 WYJLLeIz0m7PfJBEOaW/wuJrkwor1PN/iK8j/lveneE9XdR8L7x6Dcg6eoSp89yVBWTfT8 yhUVDLcb6JNnTIO8jkCylw30yhm4U4xW+5d66WblBUyHHCcLBAFv0n17t8a13Lug/jGkj4 c5MhM8H7D8VUvVwWiXH/P2oKv/a7g3rPdcV2N4/p3XT+kr6A+C4A9IjmaWwseZf8OKE1oG LMHHGlV/f3oHk4RdmLV+wAfq8okTJWTR5+hRc5eGMpz4V+dgUaX4nGD+Ry6IKA== 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 4LnDm058thzFLG; Tue, 19 Jul 2022 09:57:52 +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 26J9vquC013077; Tue, 19 Jul 2022 09:57:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 26J9vqAE013076; Tue, 19 Jul 2022 09:57:52 GMT (envelope-from git) Date: Tue, 19 Jul 2022 09:57:52 GMT Message-Id: <202207190957.26J9vqAE013076@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: =?utf-8?Q?Kornel=20Dul=C4=99ba?= Subject: git: 0f39272b883a - stable/13 - stand/uboot: setup archsw before probing devices List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kd X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 0f39272b883aafd2a47a65f7c20afc1d2c0bbc2f Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1658224672; 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=cgJV+0Ag4BJ0u/Rm6M0MCGMEg/teetbWTXQDgkMMGQA=; b=T0v7dIyNyMwPcdt5tk1LJwolgo/2On8Trtcju1Vh0JRUQaBDZ97yn68xU/l4plN2mFFD5P 7mpXnjWF/XDjYtNDZPatrU+WQPKUKSrJnMArTvmXxG81dSgUP45jPbastO7Zcg8iSx5Ehd /EXNPqp1vB7u8DZ7K/KcziJKl1kHAC4wwnGHPVqGVlhilZ3QfXxJy5bTlJ3hB2gacQ/CyP igET/RElCwktR6zGs+gfu2zLCMSi0snrQLXZI5LleDt9SeVNus8u5t/znVCqVvMT85BebV gzV8y8rY51k+uupWqa5mg1EPUd/WuSGxhGcXO5kMPUCOgKKRiDylTGz+TQDUWA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1658224672; a=rsa-sha256; cv=none; b=tn/edolgnzu/S6fkL+Vfnh6o3SiLoIbckgLg6ERmaZAo5ZksPZxT7X6Rh2DEj8nUNQM/QL yvaTbG1QhdYGXtT7HVNyUctV7eueZEDCxPVl8xo9ISBO17y3q1UTcHQyoMb4G3xKSAwoWb oV+uRyQ2/S9lizMOgiG7DSSOFpXjnF3bx1N6xlDaQ22HyauSUt4FGGojGE5i8pUQVd/rsD Dw94Dq15llAJAJDloCXFAyx3qypBPc6gEYhXtzN+41kwKrHefY+cxrD37QfKtOgVLHBwIZ 78rZjMdNiB8nm0ZRH3VOfsnh/UPLvNOjEiZfj5m0zoxr56Aaaq2Vef8R+7Jc3g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kd: URL: https://cgit.FreeBSD.org/src/commit/?id=0f39272b883aafd2a47a65f7c20afc1d2c0bbc2f commit 0f39272b883aafd2a47a65f7c20afc1d2c0bbc2f Author: Albert Jakiela AuthorDate: 2022-06-28 15:28:35 +0000 Commit: Kornel Dulęba CommitDate: 2022-07-19 09:37:10 +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 (cherry picked from commit 1323f0aa9cb0392d2946226bd76f14463e875a60) --- stand/uboot/common/main.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/stand/uboot/common/main.c b/stand/uboot/common/main.c index 85ddf5db1f90..6648dc607c11 100644 --- a/stand/uboot/common/main.c +++ b/stand/uboot/common/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);