mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-11-27 17:52:43 +00:00
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
This commit is contained in:
parent
9e337d53de
commit
1323f0aa9c
@ -475,6 +475,13 @@ main(int argc, char **argv)
|
|||||||
|
|
||||||
meminfo();
|
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. */
|
/* Set up currdev variable to have hooks in place. */
|
||||||
env_setenv("currdev", EV_VOLATILE, "", uboot_setcurrdev, env_nounset);
|
env_setenv("currdev", EV_VOLATILE, "", uboot_setcurrdev, env_nounset);
|
||||||
|
|
||||||
@ -538,13 +545,6 @@ do_interact:
|
|||||||
setenv("usefdt", "1", 1);
|
setenv("usefdt", "1", 1);
|
||||||
#endif
|
#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 */
|
interact(); /* doesn't return */
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
|
Loading…
Reference in New Issue
Block a user