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 <[email protected]>
> ---
> 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
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html