[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v4 1/3] hw/riscv/boot.c: calculate fdt size after fdt_pack()
From: |
Bin Meng |
Subject: |
Re: [PATCH v4 1/3] hw/riscv/boot.c: calculate fdt size after fdt_pack() |
Date: |
Sun, 29 Jan 2023 10:20:56 +0800 |
Hi Daniel,
On Thu, Jan 26, 2023 at 9:53 PM Daniel Henrique Barboza
<dbarboza@ventanamicro.com> wrote:
>
> fdt_pack() can change the fdt size, meaning that fdt_totalsize() can
> contain a now deprecated (bigger) value.
The commit message is a bit confusing.
The original code in this patch does not call fdt_pack(). So not sure
where the issue of "deprecated (bigger) value" happens?
>
> Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
> Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
> ---
> hw/riscv/boot.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/hw/riscv/boot.c b/hw/riscv/boot.c
> index 3172a76220..a563b7482a 100644
> --- a/hw/riscv/boot.c
> +++ b/hw/riscv/boot.c
> @@ -287,8 +287,13 @@ uint64_t riscv_load_fdt(hwaddr dram_base, uint64_t
> mem_size, void *fdt)
> {
> uint64_t temp, fdt_addr;
> hwaddr dram_end = dram_base + mem_size;
> - int ret, fdtsize = fdt_totalsize(fdt);
> + int ret = fdt_pack(fdt);
> + int fdtsize;
>
> + /* Should only fail if we've built a corrupted tree */
> + g_assert(ret == 0);
> +
> + fdtsize = fdt_totalsize(fdt);
> if (fdtsize <= 0) {
> error_report("invalid device-tree");
> exit(1);
Regards,
Bin
- [PATCH v4 0/3] riscv_load_fdt() semantics change, Daniel Henrique Barboza, 2023/01/26
- [PATCH v4 1/3] hw/riscv/boot.c: calculate fdt size after fdt_pack(), Daniel Henrique Barboza, 2023/01/26
- Re: [PATCH v4 1/3] hw/riscv/boot.c: calculate fdt size after fdt_pack(),
Bin Meng <=
- [PATCH v4 2/3] hw/riscv: split fdt address calculation from fdt load, Daniel Henrique Barboza, 2023/01/26
- [PATCH v4 3/3] hw/riscv: change riscv_compute_fdt_addr() semantics, Daniel Henrique Barboza, 2023/01/26
- Re: [PATCH v4 3/3] hw/riscv: change riscv_compute_fdt_addr() semantics, Bin Meng, 2023/01/29
- Re: [PATCH v4 3/3] hw/riscv: change riscv_compute_fdt_addr() semantics, Daniel Henrique Barboza, 2023/01/30
- Re: [PATCH v4 3/3] hw/riscv: change riscv_compute_fdt_addr() semantics, Daniel Henrique Barboza, 2023/01/30
- Re: [PATCH v4 3/3] hw/riscv: change riscv_compute_fdt_addr() semantics, Bin Meng, 2023/01/30
- Re: [PATCH v4 3/3] hw/riscv: change riscv_compute_fdt_addr() semantics, Daniel Henrique Barboza, 2023/01/31
- Re: [PATCH v4 3/3] hw/riscv: change riscv_compute_fdt_addr() semantics, Bin Meng, 2023/01/31