[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-ppc] [RFC PATCH 1/9] spapr: fix off-by-one error in spapr_ovec
From: |
Thomas Huth |
Subject: |
Re: [Qemu-ppc] [RFC PATCH 1/9] spapr: fix off-by-one error in spapr_ovec_populate_dt() |
Date: |
Tue, 7 Feb 2017 16:47:53 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 |
On 07.02.2017 03:56, Sam Bobroff wrote:
> The last byte of the option vector was missing due to an off-by-one
> error. Without this fix, client architecture support negotiation will
> fail because the last byte of option vector 5, which contains the MMU
> support, will be missed.
>
> Signed-off-by: Sam Bobroff <address@hidden>
> ---
> hw/ppc/spapr_ovec.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/ppc/spapr_ovec.c b/hw/ppc/spapr_ovec.c
> index 4f4c090a29..18dbc4a9ac 100644
> --- a/hw/ppc/spapr_ovec.c
> +++ b/hw/ppc/spapr_ovec.c
> @@ -251,7 +251,7 @@ int spapr_ovec_populate_dt(void *fdt, int fdt_offset,
> }
> }
>
> - return fdt_setprop(fdt, fdt_offset, name, vec, vec_len);
> + return fdt_setprop(fdt, fdt_offset, name, vec, vec_len + 1);
> }
It took a while 'til I understood the encoding / length calculation of
the property here, but I think you're right. According to LoPAPR the
total length of the property is n+2 where n is the value of the first
byte. Since n is vec_len-1 in the QEMU code, vec_len+1 is the right
value for the property length.
Reviewed-by: Thomas Huth <address@hidden>
- [Qemu-ppc] [RFC PATCH 0/9] ISA 3.00 KVM guest support, Sam Bobroff, 2017/02/06
- [Qemu-ppc] [RFC PATCH 1/9] spapr: fix off-by-one error in spapr_ovec_populate_dt(), Sam Bobroff, 2017/02/06
- [Qemu-ppc] [RFC PATCH 4/9] target-ppc: support KVM_CAP_PPC_MMU_RADIX, KVM_CAP_PPC_MMU_HASH_V3, Sam Bobroff, 2017/02/06
- [Qemu-ppc] [RFC PATCH 3/9] spapr: Add ibm, processor-radix-AP-encodings to the device tree, Sam Bobroff, 2017/02/06
- [Qemu-ppc] [RFC PATCH 2/9] Update headers using update-linux-headers.sh, Sam Bobroff, 2017/02/06