From: "Mark A. Greer" <mgreer@mvista.com>
To: Scott Wood <scottwood@freescale.com>
Cc: linuxppc-dev <Linuxppc-dev@ozlabs.org>
Subject: Re: [PATCH] powerpc: Add dt_xlate_addr() to bootwrapper
Date: Fri, 13 Apr 2007 15:36:54 -0700 [thread overview]
Message-ID: <20070413223654.GA14653@mag.az.mvista.com> (raw)
In-Reply-To: <20070413222551.GA8258@ld0162-tx32.am.freescale.net>
On Fri, Apr 13, 2007 at 05:25:51PM -0500, Scott Wood wrote:
> On Fri, Apr 13, 2007 at 01:23:43PM -0700, Mark A. Greer wrote:
> > +int dt_xlate(void *node, u32 *buf, int buflen, int res, unsigned long *addr,
> > + unsigned long *size)
> > {
> > - u32 last_addr[MAX_ADDR_CELLS];
> > - u32 this_addr[MAX_ADDR_CELLS];
> > - u32 buf[MAX_ADDR_CELLS * MAX_RANGES * 3];
> > + u32 last_addr[DT_MAX_ADDR_CELLS];
> > + u32 this_addr[DT_MAX_ADDR_CELLS];
> > void *parent;
>
> This causes it to use the caller-provided buffer to read the ranges
> property, which may not be large enough in the case of dt_xlate_addr().
> Plus, buf being a pointer rather than an array will cause the sizeof(buf)
> that gets passed to getprop() to be only sizeof(u32 *).
>
> Instead, I'd declare "rangebuf" as a static array, and accept "regbuf" as
> a parameter (with a comment that regbuf can alias rangebuf). Then,
> dt_xlate_reg() can use rangebuf as regbuf, dt_xlate_addr()'s caller
> doesn't have to worry about its buffer being big enough to hold ranges,
> and we don't have to allocate two 384-byte buffers on the stack.
Okay, I'll look closer this time. Thanks for checking.
Mark
next prev parent reply other threads:[~2007-04-13 22:36 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-13 20:23 [PATCH] powerpc: Add dt_xlate_addr() to bootwrapper Mark A. Greer
2007-04-13 22:25 ` Scott Wood
2007-04-13 22:36 ` Mark A. Greer [this message]
2007-04-25 21:16 ` Mark A. Greer
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=20070413223654.GA14653@mag.az.mvista.com \
--to=mgreer@mvista.com \
--cc=Linuxppc-dev@ozlabs.org \
--cc=scottwood@freescale.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).