public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Wolfgang Denk <wd@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] reading ethaddr from env
Date: Thu, 24 Feb 2005 23:49:50 +0100	[thread overview]
Message-ID: <20050224224955.25547C1430@atlas.denx.de> (raw)
In-Reply-To: Your message of "Wed, 23 Feb 2005 11:01:42 +0100." <20050223100142.GA3003@nabla101>

In message <20050223100142.GA3003@nabla101> you wrote:
> 
> When u-boot starts and try to read the ethaddr, (lib_arm/board.c at 296),
> the parameter tmp used in the function getenv_r is pointing to the gd->bd
> structure, so the execution of this function corrupts the data stored in
> it.

You are wrong. "tmp" is a local array, declared in line 294:

    294                 uchar tmp[64];
    295
    296                 i = getenv_r ("ethaddr", tmp, sizeof (tmp));

> I've found a "dirty" workaround of this problem rising the size of tmp
> buffer:

What exactly is your problem?

>                 /* uchar tmp[64]; */
>                 uchar tmp[128];
> 
>                 i = getenv_r ("ethaddr", tmp, sizeof (tmp));

Why do you think that 64 bytes should be insufficient  to  store  the
MAC address?

> As you can see the tmp buffer is pointing to the gd->bd plus 4.

At least this is what the debugger claims.

> Any hints ?

I cannot reproduce this problem here. WHat do you get  when  you  use
printf() to display the addresses _before_ calling getenv_r()?

Best regards,

Wolfgang Denk

-- 
See us @ Embedded World, Nuremberg, Feb 22 - 24,  Hall 10.0 Booth 310
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
As a general rule, the freedom of any people can  be  judged  by  the
volume of their laughter.

  reply	other threads:[~2005-02-24 22:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-23 10:01 [U-Boot-Users] reading ethaddr from env Juan Antonio Garcia Redondo
2005-02-24 22:49 ` Wolfgang Denk [this message]
2005-02-25 10:44   ` Juan Antonio Garcia Redondo

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=20050224224955.25547C1430@atlas.denx.de \
    --to=wd@denx.de \
    --cc=u-boot@lists.denx.de \
    /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