qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Alexey Kardashevskiy <aik@ozlabs.ru>
Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [PATCH qemu v2] spapr: Kill SLOF
Date: Tue, 7 Jan 2020 10:56:04 +1100	[thread overview]
Message-ID: <20200106235604.GA2098@umbus> (raw)
In-Reply-To: <d8ad377b-3ac1-d190-af5e-342b0e0ba47d@ozlabs.ru>

[-- Attachment #1: Type: text/plain, Size: 1968 bytes --]

On Tue, Jan 07, 2020 at 12:39:42AM +1100, Alexey Kardashevskiy wrote:
> 
> 
> On 06/01/2020 15:19, David Gibson wrote:
> 
> > > +    const struct fdt_property *prop;
> > > +    const char *tmp;
> > > +
> > > +    readstr(prevaddr, prev);
> > > +    for (offset = fdt_first_property_offset(fdt, offset);
> > > +         (offset >= 0);
> > > +         (offset = fdt_next_property_offset(fdt, offset))) {
> > > +
> > > +        prop = fdt_get_property_by_offset(fdt, offset, &namelen);
> > 
> > fdt_getprop_by_offset() also returns the property's name without
> > having to dick around with fdt_get_string() manually.
> 
> 
> btw I looked quickly:
> 
> const void *fdt_getprop_by_offset(const void *fdt, int offset,
>                   const char **namep, int *lenp)
> {
>     const struct fdt_property *prop;
> 
>     prop = fdt_get_property_by_offset_(fdt, offset, lenp);
>     if (!prop)
>         return NULL;
>     if (namep) {
>         const char *name;
>         int namelen;
>         name = fdt_get_string(fdt, fdt32_ld(&prop->nameoff),
>                       &namelen);
>         if (!name) {
>             if (lenp)
>                 *lenp = namelen;
>             return NULL;
>         }
>         *namep = name;
>     }
> 
>     /* Handle realignment */
>     if (fdt_version(fdt) < 0x10 && (offset + sizeof(*prop)) % 8 &&
>         fdt32_ld(&prop->len) >= 8)
>         return prop->data + 4;
>     return prop->data;
> }
> 
> 
> and incorrectly assumed *lenp is the name length because of "*lenp =
> namelen". Huh :)

Ah, yeah, that is a bit confusing, but I don't see a way to improve
it.  That's the error case, in which case both *lenp and namelen are
carrying an error code, not their usual value.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2020-01-07  0:04 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-05 23:42 [PATCH qemu v2] spapr: Kill SLOF Alexey Kardashevskiy
2020-01-06  4:19 ` David Gibson
2020-01-06  6:28   ` Alexey Kardashevskiy
2020-01-06  8:50     ` David Gibson
2020-01-06 12:34       ` Alexey Kardashevskiy
2020-01-06 17:09         ` Cédric Le Goater
2020-01-06 17:25           ` Peter Maydell
2020-01-06 18:56             ` Philippe Mathieu-Daudé
2020-01-07  1:44             ` Alexey Kardashevskiy
2020-01-07  5:26         ` David Gibson
2020-01-08  4:07           ` Alexey Kardashevskiy
2020-01-09  4:07             ` David Gibson
2020-01-09  6:31               ` Alexey Kardashevskiy
2020-01-13  3:32                 ` David Gibson
2020-01-06 13:39   ` Alexey Kardashevskiy
2020-01-06 23:56     ` David Gibson [this message]
2020-01-07  4:44   ` Alexey Kardashevskiy
2020-01-07  5:54     ` David Gibson
2020-01-08  4:20       ` Alexey Kardashevskiy
2020-01-08  5:53         ` Alexey Kardashevskiy
2020-01-09  4:25           ` David Gibson
2020-01-09  4:18         ` David Gibson

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=20200106235604.GA2098@umbus \
    --to=david@gibson.dropbear.id.au \
    --cc=aik@ozlabs.ru \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@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).