Author: mcayland Date: Thu Feb 28 00:06:10 2013 New Revision: 1100 URL: http://tracker.coreboot.org/trac/openbios/changeset/1100
Log: mac-parts.c: Fix /packages/mac-parts boot when the package arguments are empty.
Commit r1072 removed a couple of NULL pointer checks for package arguments, however if the arguments are empty in Forth then they are converted back to a NULL pointer which causes an exception when dereferenced.
Add the checks back in which fixes boot of the debian_lenny_powerpc_small.qcow2 test image with quik once again. Based upon an earlier patch by Alexander Graf agraf@suse.de.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk CC: Alexander Graf agraf@suse.de
Modified: trunk/openbios-devel/packages/mac-parts.c
Modified: trunk/openbios-devel/packages/mac-parts.c ============================================================================== --- trunk/openbios-devel/packages/mac-parts.c Sat Feb 16 13:08:33 2013 (r1099) +++ trunk/openbios-devel/packages/mac-parts.c Thu Feb 28 00:06:10 2013 (r1100) @@ -68,7 +68,7 @@ [(id)][,][filespec] */ - if ( strlen(str) ) { + if ( str && strlen(str) ) { /* Detect the arguments */ if ((*str >= '0' && *str <= '9') || (*str == ',')) { push_str(str); @@ -126,7 +126,7 @@ * Implement partition selection as per the PowerPC Microprocessor CHRP bindings */
- if (parnum == 0) { + if (str == NULL || parnum == 0) { /* According to the spec, partition 0 as well as no arguments means the whole disk */ offs = (long long)0; size = (long long)__be32_to_cpu(dmap.sbBlkCount) * bs;