Don't call strcmp with a NULL pointer.
In particular, on the AM335x, which comes up with no memory mapped to low addresses, dereferencing the NULL causes a crash.
This commit is contained in:
parent
8c501e516b
commit
5bf877dace
@ -116,6 +116,16 @@ meminfo(void)
|
||||
}
|
||||
}
|
||||
|
||||
static uint64_t
|
||||
uboot_loadaddr(u_int type, void *data, uint64_t addr)
|
||||
{
|
||||
printf("uboot_loadaddr: type=%d data=0x%x addr=0x%x\n",
|
||||
type, data, addr);
|
||||
if (type == 1)
|
||||
return 0x40000000;
|
||||
return (addr);
|
||||
}
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
@ -211,6 +221,7 @@ main(void)
|
||||
archsw.arch_copyout = uboot_copyout;
|
||||
archsw.arch_readin = uboot_readin;
|
||||
archsw.arch_autoload = uboot_autoload;
|
||||
archsw.arch_loadaddr = uboot_loadaddr;
|
||||
|
||||
interact(); /* doesn't return */
|
||||
|
||||
|
@ -72,6 +72,7 @@ static int
|
||||
md_getboothowto(char *kargs)
|
||||
{
|
||||
char *cp;
|
||||
char *p;
|
||||
int howto;
|
||||
int active;
|
||||
int i;
|
||||
@ -132,10 +133,12 @@ md_getboothowto(char *kargs)
|
||||
if (getenv(howto_names[i].ev) != NULL)
|
||||
howto |= howto_names[i].mask;
|
||||
}
|
||||
if (!strcmp(getenv("console"), "comconsole"))
|
||||
howto |= RB_SERIAL;
|
||||
if (!strcmp(getenv("console"), "nullconsole"))
|
||||
howto |= RB_MUTE;
|
||||
if ((p = getenv("console"))) {
|
||||
if (!strcmp(p, "comconsole"))
|
||||
howto |= RB_SERIAL;
|
||||
if (!strcmp(p, "nullconsole"))
|
||||
howto |= RB_MUTE;
|
||||
}
|
||||
|
||||
return(howto);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user