qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] S390: file size checking in load_image_targphys and cer


From: Alexander Graf
Subject: Re: [Qemu-devel] S390: file size checking in load_image_targphys and certain ram sizes
Date: Thu, 3 May 2012 15:51:15 +0200

On 03.05.2012, at 15:36, Christian Borntraeger wrote:

> 
> Ben, Alex,
> 
> commit 17df768c1e4580f03301d18ea938d3557d441911
>    load_image_targphys() should enforce the max size
> 
> caused some problems with external kernel and specific ram sizes on s390:
> 
> We load the external kernel with
> 
> [...]
>            kernel_size = load_image_targphys(kernel_filename, 0, ram_size);
> [...]
> 
> The problem is now, that load_image_targphys has max_sz as an int (32bit), 
> but 
> ram_size is a ram_addr_t (64bit).
> So for a ramsize of lets say 3GB the comparison in load_image_targphys fails:
> 
>    if (size > max_sz) {
>        return -1;
>    }
> 
> There are several potential ways of solving, suggestions for a better solution
> than the patch below are welcome.

The proposed solution looks perfectly fine. In fact I remember having had a 
very similar discussion on an ARM issue and the conclusion we came up with was 
to use the biggest available data type: uint64_t.

Pleas repost this as a proper patch with Signed-off-by :).


Alex




reply via email to

[Prev in Thread] Current Thread [Next in Thread]