From: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
To: Rob Herring <robh@kernel.org>
Cc: Saravana Kannan <saravanak@google.com>,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] libfdt: check return value of fdt_num_mem_rsv() in fdt_pack()
Date: Tue, 2 Jul 2024 22:31:21 +0200 [thread overview]
Message-ID: <242c0c30-87db-468e-a3e0-c211a93ae8a3@canonical.com> (raw)
In-Reply-To: <CAL_JsqKgsD2UN2FTvz3AByc8TSdGsrSJZGUM1Fr-v2yhu0gh-g@mail.gmail.com>
On 7/2/24 19:31, Rob Herring wrote:
> On Mon, Jul 1, 2024 at 3:55 PM Heinrich Schuchardt
> <heinrich.schuchardt@canonical.com> wrote:
>>
>> fdt_num_mem_rsv() may return -FDT_ERR_TRUNCATED.
>> In this case fdt_pack() should propagate the error code.
>>
>> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
>> ---
>> libfdt/fdt_rw.c | 7 +++++--
>> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> This needs to be sent to David G and devicetree-compiler list to be applied.
Thanks Rob.
I should not have looked in Linux' MAINTAINERS file but into dtc's
README.md.
Best regards
Heinrich
>
>>
>> diff --git a/libfdt/fdt_rw.c b/libfdt/fdt_rw.c
>> index 3621d36..a307701 100644
>> --- a/libfdt/fdt_rw.c
>> +++ b/libfdt/fdt_rw.c
>> @@ -490,8 +490,11 @@ int fdt_pack(void *fdt)
>>
>> FDT_RW_PROBE(fdt);
>>
>> - mem_rsv_size = (fdt_num_mem_rsv(fdt)+1)
>> - * sizeof(struct fdt_reserve_entry);
>> + mem_rsv_size = fdt_num_mem_rsv(fdt);
>> + if (mem_rsv_size < 0)
>> + return mem_rsv_size;
>> +
>> + mem_rsv_size = (mem_rsv_size + 1) * sizeof(struct fdt_reserve_entry);
>> fdt_packblocks_(fdt, fdt, mem_rsv_size, fdt_size_dt_struct(fdt),
>> fdt_size_dt_strings(fdt));
>> fdt_set_totalsize(fdt, fdt_data_size_(fdt));
>> --
>> 2.45.2
>>
>>
prev parent reply other threads:[~2024-07-02 20:31 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-01 21:54 Heinrich Schuchardt
2024-07-02 12:54 ` [PATCH] " Markus Elfring
2024-07-02 20:27 ` Heinrich Schuchardt
2024-07-03 8:43 ` Markus Elfring
2024-07-02 17:31 ` [PATCH 1/1] " Rob Herring
2024-07-02 20:31 ` Heinrich Schuchardt [this message]
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=242c0c30-87db-468e-a3e0-c211a93ae8a3@canonical.com \
--to=heinrich.schuchardt@canonical.com \
--cc=devicetree@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robh@kernel.org \
--cc=saravanak@google.com \
/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
all inboxes | Powered by JetHome®