[OpenBIOS] [commit] r1238 - trunk/openbios-devel/arch/sparc32
repository service
svn at openbios.org
Tue Dec 10 22:01:46 CET 2013
Author: mcayland
Date: Tue Dec 10 22:01:46 2013
New Revision: 1238
URL: http://tracker.coreboot.org/trac/openbios/changeset/1238
Log:
SPARC32: fix NULL pointer reference when booting from device with no arguments
When booting from a device with no arguments (such as "disk"), the resulting
partition id string would be NULL causing an exception when setting up the
romvec slice identifier. In the case where no slice is specified, we simply
set the partition to 0 in order to preserve existing behaviour.
This fixes booting from hard disk on QEMU as reported by Paul Wilhelm and
Aurelien Jarno.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland at ilande.co.uk>
Modified:
trunk/openbios-devel/arch/sparc32/boot.c
Modified: trunk/openbios-devel/arch/sparc32/boot.c
==============================================================================
--- trunk/openbios-devel/arch/sparc32/boot.c Tue Dec 10 22:01:42 2013 (r1237)
+++ trunk/openbios-devel/arch/sparc32/boot.c Tue Dec 10 22:01:46 2013 (r1238)
@@ -98,10 +98,15 @@
fword("my-args");
id = pop_fstr_copy();
- snprintf(buf, sizeof(buf), "sd(0,%d,%d):%c", target, device, id[0]);
+ if (id != NULL) {
+ snprintf(buf, sizeof(buf), "sd(0,%d,%d):%c", target, device, id[0]);
+ obp_arg.dev_partition = id[0] - 'a';
+ } else {
+ snprintf(buf, sizeof(buf), "sd(0,%d,%d)", target, device);
+ obp_arg.dev_partition = 0;
+ }
obp_arg.boot_dev_unit = target;
- obp_arg.dev_partition = id[0] - 'a';
obp_arg.boot_dev[0] = buf[0];
obp_arg.boot_dev[1] = buf[1];
More information about the OpenBIOS
mailing list