|
From: | Mark Cave-Ayland |
Subject: | Re: [Qemu-ppc] [Qemu-devel] [PATCH] Revert "Update OpenBIOS images" |
Date: | Thu, 14 Feb 2013 00:54:17 +0000 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:10.0.12) Gecko/20130116 Icedove/10.0.12 |
On 14/02/13 00:17, Alexander Graf wrote:
With the following patch fixing the issue at hand for me. Though I don't fully understand why str would be NULL yet: diff --git a/packages/mac-parts.c b/packages/mac-parts.c index a286870..443455e 100644 --- a/packages/mac-parts.c +++ b/packages/mac-parts.c @@ -140,7 +140,7 @@ macparts_open( macparts_info_t *di ) * 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; Alex
Ah okay. It's actually caused by this bit of logic in libopenbios/bindings.c and assuming that my_args() is a zero length Forth string:
char * pop_fstr_copy( void ) { int len = POP(); char *str, *p = (char*)cell2pointer(POP()); if( !len ) return NULL; str = malloc( len + 1 ); if( !str ) return NULL; memcpy( str, p, len ); str[len] = 0; return str; }The check for a zero length string and returning NULL has caused me problems before when round-tripping strings between Forth and C.
Without testing the patch myself, I'd say that it looks good. I can run it over my complete set of test images tomorrow evening if that would be acceptable? Can you post a git diff version to the OpenBIOS mailing list too?
ATB, Mark.
[Prev in Thread] | Current Thread | [Next in Thread] |