[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 02/12] s390: Lowcore mapping helper.
From: |
Alexander Graf |
Subject: |
Re: [Qemu-devel] [PATCH 02/12] s390: Lowcore mapping helper. |
Date: |
Fri, 18 Jan 2013 17:54:33 +0100 |
On 17.01.2013, at 15:23, Cornelia Huck wrote:
> Create a lowcore mapping helper that includes a check for sufficient
> length.
>
> Signed-off-by: Cornelia Huck <address@hidden>
> ---
> target-s390x/helper.c | 31 +++++++++++++++++++++++++------
> 1 file changed, 25 insertions(+), 6 deletions(-)
>
> diff --git a/target-s390x/helper.c b/target-s390x/helper.c
> index 9a132e6..bf2b4d3 100644
> --- a/target-s390x/helper.c
> +++ b/target-s390x/helper.c
> @@ -471,13 +471,32 @@ static uint64_t get_psw_mask(CPUS390XState *env)
> return r;
> }
>
> +static LowCore *cpu_map_lowcore(CPUS390XState *env, hwaddr *len)
Just declare len to PAGE_SIZE * 2, like you do in kvm. Or to sizeof(LowCore).
Then don't pass it in as parameter, but basically guarantee that the function
always returns a full LowCore struct.
> +{
> + LowCore *lowcore;
> +
> + if (*len < sizeof(LowCore)) {
> + cpu_abort(env, "Insufficient length %d for mapping lowcore\n",
> + (int) *len);
> + }
> +
> + lowcore = cpu_physical_memory_map(env->psa, len, 1);
Here is the place where the size check should be really :).
Alex
- [Qemu-devel] [PATCH v5 00/12] s390: channel I/O support in qemu., Cornelia Huck, 2013/01/17
- [Qemu-devel] [PATCH 06/12] s390: I/O interrupt and machine check injection., Cornelia Huck, 2013/01/17
- [Qemu-devel] [PATCH 05/12] s390: Channel I/O basic defintions., Cornelia Huck, 2013/01/17
- [Qemu-devel] [PATCH 07/12] s390: Add channel I/O instructions., Cornelia Huck, 2013/01/17
- [Qemu-devel] [PATCH 12/12] s390: Add s390-ccw-virtio machine., Cornelia Huck, 2013/01/17