All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bin Meng <bmeng.cn@gmail.com>
To: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Cc: qemu-devel@nongnu.org, qemu-riscv@nongnu.org, alistair.francis@wdc.com
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	[thread overview]
Message-ID: <CAEUhbmUyG1_6Aea-kt_dWNvqJtFMojuuUwABBOe4oPrecwLdOw@mail.gmail.com> (raw)
In-Reply-To: <20230126135219.1054658-2-dbarboza@ventanamicro.com>

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


  reply	other threads:[~2023-01-29  2:22 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-26 13:52 [PATCH v4 0/3] riscv_load_fdt() semantics change Daniel Henrique Barboza
2023-01-26 13:52 ` [PATCH v4 1/3] hw/riscv/boot.c: calculate fdt size after fdt_pack() Daniel Henrique Barboza
2023-01-29  2:20   ` Bin Meng [this message]
2023-01-29  3:06     ` Bin Meng
2023-01-26 13:52 ` [PATCH v4 2/3] hw/riscv: split fdt address calculation from fdt load Daniel Henrique Barboza
2023-01-29  5:16   ` Bin Meng
2023-01-26 13:52 ` [PATCH v4 3/3] hw/riscv: change riscv_compute_fdt_addr() semantics Daniel Henrique Barboza
2023-01-29  5:45   ` Bin Meng
2023-01-30 17:16     ` Daniel Henrique Barboza
2023-01-30 18:02       ` Daniel Henrique Barboza
2023-01-31  1:00       ` Bin Meng
2023-01-31  9:57         ` Daniel Henrique Barboza
2023-01-31 12:11           ` Bin Meng
2023-01-26 18:40 ` [PATCH v4 0/3] riscv_load_fdt() semantics change Conor Dooley

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=CAEUhbmUyG1_6Aea-kt_dWNvqJtFMojuuUwABBOe4oPrecwLdOw@mail.gmail.com \
    --to=bmeng.cn@gmail.com \
    --cc=alistair.francis@wdc.com \
    --cc=dbarboza@ventanamicro.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.