All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shinya Kuribayashi <shinya.kuribayashi@necel.com>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [PATCH] net/eth.c: Fix env_enetaddr signed overflow
Date: Mon, 19 Nov 2007 20:27:04 +0900	[thread overview]
Message-ID: <47417308.7030100@necel.com> (raw)

My colleague founded this problem months ago. I'd like to see this bug
fixed in 1.3.0. Please apply.

---
net/eth.c: Fix env_enetaddr signed overflow

Assigning the output of simple_strtoul(CB:A9:87:65:43:21) to `char', we are
warned as below:

  U-Boot 1.2.0 (Aug 30 2007 - 08:27:37)
  
  DRAM:  256 MB
  Flash: 32 MB
  In:    serial
  Out:   serial
  Err:   serial
  Net:   NEC-Candy
  Warning: NEC-Candy MAC addresses don't match:
  Address in SROM is         00:00:4C:80:92:A2
  Address in environment is  FFFFFFCB:FFFFFFA9:FFFFFF87:65:43:21

This patch changes env_enetaddr type from `char' to `unsigned char'.

Cc: Masaki Ishikawa <ishikawa-masaki@cnt.mxe.nes.nec.co.jp>
Signed-off-by: Shinya Kuribayashi <shinya.kuribayashi@necel.com>
---

 net/eth.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/net/eth.c b/net/eth.c
index 1b56a35..64ef312 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -138,7 +138,8 @@ int eth_register(struct eth_device* dev)
 
 int eth_initialize(bd_t *bis)
 {
-	char enetvar[32], env_enetaddr[6];
+	char enetvar[32];
+	unsigned char env_enetaddr[6];
 	int i, eth_number = 0;
 	char *tmp, *end;
 

-- 
Shinya Kuribayashi
NEC Electronics

             reply	other threads:[~2007-11-19 11:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-19 11:27 Shinya Kuribayashi [this message]
2007-11-19 15:15 ` [U-Boot-Users] [PATCH] net/eth.c: Fix env_enetaddr signed overflow Ben Warren
2007-11-19 15:39   ` Shinya Kuribayashi

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=47417308.7030100@necel.com \
    --to=shinya.kuribayashi@necel.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.