[OpenBIOS] [PATCH] Fix mac label whole partition case

Mark Cave-Ayland mark.cave-ayland at ilande.co.uk
Sat Feb 23 17:54:55 CET 2013


On 14/02/13 01:02, Alexander Graf wrote:

> Commit r1072 removed the check for NULL pointer strings in the mac
> partition lookup. However, without that check we would end up dereferencing
> this string pointer later, breaking my Debian Lenny test image.
>
> Add the check back in. This fixes Lenny with quik again.
>
> Signed-off-by: Alexander Graf<agraf at suse.de>
> ---
>   packages/mac-parts.c |    2 +-
>   1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/packages/mac-parts.c b/packages/mac-parts.c
> index d0cba05..330d8a0 100644
> --- a/packages/mac-parts.c
> +++ b/packages/mac-parts.c
> @@ -126,7 +126,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;

Strangely this works for me if I build with -O0 -g but not with the 
default of -Os -g. Investigating...


ATB,

Mark.



More information about the OpenBIOS mailing list