From: Thomas Huth <thuth@redhat.com>
To: Andrew Jones <drjones@redhat.com>, kvm@vger.kernel.org
Cc: lvivier@redhat.com, pbonzini@redhat.com
Subject: Re: [kvm-unit-tests PATCH v2 4/4] devicetree: dt_get_nr_cells output robustness
Date: Wed, 11 May 2016 17:36:48 +0200 [thread overview]
Message-ID: <57335190.4000908@redhat.com> (raw)
In-Reply-To: <1462973121-14548-5-git-send-email-drjones@redhat.com>
On 11.05.2016 15:25, Andrew Jones wrote:
> Only assign outputs if both address and size are found.
>
> Signed-off-by: Andrew Jones <drjones@redhat.com>
> ---
> lib/devicetree.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/lib/devicetree.c b/lib/devicetree.c
> index c091459a94e27..6ebd4ff5b2a9c 100644
> --- a/lib/devicetree.c
> +++ b/lib/devicetree.c
> @@ -23,21 +23,24 @@ int dt_get_nr_cells(int fdtnode, u32 *nr_address_cells, u32 *nr_size_cells)
> {
> const struct fdt_property *prop;
> u32 *nr_cells;
> - int len;
> + int len, nac, nsc;
>
> prop = fdt_get_property(fdt, fdtnode, "#address-cells", &len);
> if (prop == NULL)
> return len;
>
> nr_cells = (u32 *)prop->data;
> - *nr_address_cells = fdt32_to_cpu(*nr_cells);
> + nac = fdt32_to_cpu(*nr_cells);
>
> prop = fdt_get_property(fdt, fdtnode, "#size-cells", &len);
> if (prop == NULL)
> return len;
>
> nr_cells = (u32 *)prop->data;
> - *nr_size_cells = fdt32_to_cpu(*nr_cells);
> + nsc = fdt32_to_cpu(*nr_cells);
> +
> + *nr_address_cells = nac;
> + *nr_size_cells = nsc;
>
> return 0;
> }
Reviewed-by: Thomas Huth <thuth@redhat.com>
prev parent reply other threads:[~2016-05-11 15:36 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-11 13:25 [kvm-unit-tests PATCH v2 0/4] devicetree: use correct #address/#size cells Andrew Jones
2016-05-11 13:25 ` [kvm-unit-tests PATCH v2 1/4] devicetree: translate with parent node's #address/size-cells Andrew Jones
2016-05-11 15:30 ` Thomas Huth
2016-05-11 13:25 ` [kvm-unit-tests PATCH v2 2/4] devicetree: don't cache #address/#size-cells Andrew Jones
2016-05-11 15:31 ` Thomas Huth
2016-05-11 13:25 ` [kvm-unit-tests PATCH v2 3/4] devicetree: remove unused globals Andrew Jones
2016-05-11 15:38 ` Thomas Huth
2016-05-11 15:46 ` Paolo Bonzini
2016-05-11 16:10 ` Andrew Jones
2016-05-11 13:25 ` [kvm-unit-tests PATCH v2 4/4] devicetree: dt_get_nr_cells output robustness Andrew Jones
2016-05-11 15:36 ` Thomas Huth [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=57335190.4000908@redhat.com \
--to=thuth@redhat.com \
--cc=drjones@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=lvivier@redhat.com \
--cc=pbonzini@redhat.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;
as well as URLs for NNTP newsgroup(s).