Author: mcayland Date: Mon May 12 17:43:50 2014 New Revision: 1294 URL: http://tracker.coreboot.org/trac/openbios/changeset/1294
Log: SPARC64: fix NULL pointer reference when attempting kernel boot
When checking to determine whether to boot a standalone kernel, we would inadvertently reference a NULL pointer if no path was found. Make sure subsequent path processing is ignored when not booting a standalone kernel so we fall through to normal Forth boot.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk
Modified: trunk/openbios-devel/arch/sparc64/boot.c
Modified: trunk/openbios-devel/arch/sparc64/boot.c ============================================================================== --- trunk/openbios-devel/arch/sparc64/boot.c Mon May 12 17:43:46 2014 (r1293) +++ trunk/openbios-devel/arch/sparc64/boot.c Mon May 12 17:43:50 2014 (r1294) @@ -105,24 +105,26 @@ path = pop_fstr_copy(); }
- param = strchr(path, ' '); - if(param) { - *param = '\0'; - param++; - } else if (cmdline_size) { - param = (char *)qemu_cmdline; - } else { - push_str("boot-args"); - push_str("/options"); - fword("(find-dev)"); - POP(); - fword("get-package-property"); - POP(); - param = pop_fstr_copy(); - } - - /* Invoke platform-specific Linux loader */ - linux_load(&sys_info, path, param); + if (path) { + param = strchr(path, ' '); + if(param) { + *param = '\0'; + param++; + } else if (cmdline_size) { + param = (char *)qemu_cmdline; + } else { + push_str("boot-args"); + push_str("/options"); + fword("(find-dev)"); + POP(); + fword("get-package-property"); + POP(); + param = pop_fstr_copy(); + } + + /* Invoke platform-specific Linux loader */ + linux_load(&sys_info, path, param);
- free(path); + free(path); + } }