From: Alistair Francis <alistair23@gmail.com>
To: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Cc: qemu-devel@nongnu.org, qemu-riscv@nongnu.org,
alistair.francis@wdc.com, philmd@linaro.org
Subject: Re: [PATCH v2 1/6] hw/riscv/boot.c: calculate fdt size after fdt_pack()
Date: Thu, 19 Jan 2023 10:36:09 +1000 [thread overview]
Message-ID: <CAKmqyKPCz3uw3mCfBkheL6a3DYm9XsvVYh2CA-iiXqQPniz25Q@mail.gmail.com> (raw)
In-Reply-To: <20230116173420.1146808-2-dbarboza@ventanamicro.com>
On Tue, Jan 17, 2023 at 3:35 AM 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.
>
> Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Alistair
> ---
> 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 2594276223..dc14d8cd14 100644
> --- a/hw/riscv/boot.c
> +++ b/hw/riscv/boot.c
> @@ -253,8 +253,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);
> --
> 2.39.0
>
>
next prev parent reply other threads:[~2023-01-19 0:37 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-16 17:34 [PATCH v2 0/6] riscv: fdt related cleanups Daniel Henrique Barboza
2023-01-16 17:34 ` [PATCH v2 1/6] hw/riscv/boot.c: calculate fdt size after fdt_pack() Daniel Henrique Barboza
2023-01-19 0:36 ` Alistair Francis [this message]
2023-01-16 17:34 ` [PATCH v2 2/6] hw/riscv: split fdt address calculation from fdt load Daniel Henrique Barboza
2023-01-19 2:13 ` Alistair Francis
2023-01-16 17:34 ` [PATCH v2 3/6] hw/riscv: simplify riscv_compute_fdt_addr() Daniel Henrique Barboza
2023-01-19 2:23 ` Alistair Francis
2023-01-19 13:00 ` Daniel Henrique Barboza
2023-01-19 16:47 ` Daniel Henrique Barboza
2023-01-16 17:34 ` [PATCH v2 4/6] hw/riscv/virt.c: calculate socket count once in create_fdt_imsic() Daniel Henrique Barboza
2023-01-19 2:15 ` Alistair Francis
2023-01-16 17:34 ` [PATCH v2 5/6] hw/riscv/virt.c: rename MachineState 'mc' pointers to 'ms' Daniel Henrique Barboza
2023-01-19 2:16 ` Alistair Francis
2023-01-16 17:34 ` [PATCH v2 6/6] hw/riscv/spike.c: rename MachineState 'mc' pointers to' ms' Daniel Henrique Barboza
2023-01-19 2:16 ` Alistair Francis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAKmqyKPCz3uw3mCfBkheL6a3DYm9XsvVYh2CA-iiXqQPniz25Q@mail.gmail.com \
--to=alistair23@gmail.com \
--cc=alistair.francis@wdc.com \
--cc=dbarboza@ventanamicro.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-riscv@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).