From: James Hogan <james.hogan@imgtec.com>
To: Grant Likely <grant.likely@linaro.org>,
Rob Herring <rob.herring@calxeda.com>,
devicetree@vger.kernel.org
Cc: James Hogan <james.hogan@imgtec.com>,
linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] of: unflatten_and_copy: handle NULL initial_boot_params
Date: Thu, 21 Nov 2013 13:49:51 +0000 [thread overview]
Message-ID: <528E0F7F.7010901@imgtec.com> (raw)
In-Reply-To: <1385041454-32385-1-git-send-email-james.hogan@imgtec.com>
On 21/11/13 13:44, James Hogan wrote:
> Check whether initial_boot_params is NULL before dereferencing it in
> unflatten_and_copy_device_tree() for the case where no device tree is
> available but the arch can still boot to a minimal usable system without
> it. In this case also log a warning for when the kernel log buffer is
> obtainable.
>
> Signed-off-by: James Hogan <james.hogan@imgtec.com>
> Cc: Grant Likely <grant.likely@linaro.org>
> Cc: Rob Herring <rob.herring@calxeda.com>
> Cc: devicetree@vger.kernel.org
> Cc: linux-arch@vger.kernel.org
Hmm, sorry, I forgot to add Grant's:
Acked-by: Grant Likely <grant.likely@linaro.org>
(from v1)
Cheers
James
> ---
> v2:
> * Log a warning for those who can obtain the kernel log buffer (Grant
> Likely).
> ---
> drivers/of/fdt.c | 12 ++++++++++--
> 1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
> index 2fa024b97c43..758b4f8b30b7 100644
> --- a/drivers/of/fdt.c
> +++ b/drivers/of/fdt.c
> @@ -922,8 +922,16 @@ void __init unflatten_device_tree(void)
> */
> void __init unflatten_and_copy_device_tree(void)
> {
> - int size = __be32_to_cpu(initial_boot_params->totalsize);
> - void *dt = early_init_dt_alloc_memory_arch(size,
> + int size;
> + void *dt;
> +
> + if (!initial_boot_params) {
> + pr_warn("No valid device tree found, continuing without\n");
> + return;
> + }
> +
> + size = __be32_to_cpu(initial_boot_params->totalsize);
> + dt = early_init_dt_alloc_memory_arch(size,
> __alignof__(struct boot_param_header));
>
> if (dt) {
>
next prev parent reply other threads:[~2013-11-21 13:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-21 13:44 [PATCH v2] of: unflatten_and_copy: handle NULL initial_boot_params James Hogan
2013-11-21 13:49 ` James Hogan [this message]
2013-12-11 13:40 ` Grant Likely
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=528E0F7F.7010901@imgtec.com \
--to=james.hogan@imgtec.com \
--cc=devicetree@vger.kernel.org \
--cc=grant.likely@linaro.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rob.herring@calxeda.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