public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot-Users] [PATCH] net/eth.c: Fix env_enetaddr signed overflow
@ 2007-11-19 11:27 Shinya Kuribayashi
  2007-11-19 15:15 ` Ben Warren
  0 siblings, 1 reply; 3+ messages in thread
From: Shinya Kuribayashi @ 2007-11-19 11:27 UTC (permalink / raw)
  To: u-boot

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [U-Boot-Users] [PATCH] net/eth.c: Fix env_enetaddr signed overflow
  2007-11-19 11:27 [U-Boot-Users] [PATCH] net/eth.c: Fix env_enetaddr signed overflow Shinya Kuribayashi
@ 2007-11-19 15:15 ` Ben Warren
  2007-11-19 15:39   ` Shinya Kuribayashi
  0 siblings, 1 reply; 3+ messages in thread
From: Ben Warren @ 2007-11-19 15:15 UTC (permalink / raw)
  To: u-boot

Shinya Kuribayashi wrote:
> 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;
>  
>
>   
This looks harmless enough, but is in a place that is touched by every 
board on every architecture, and the bug doesn't really seem to hurt 
anything other than printing garbage. IMHO it should wait until the next 
release. I will apply it to a 'for_1.3.1' branch of the net tree.

regards,
Ben

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [U-Boot-Users] [PATCH] net/eth.c: Fix env_enetaddr signed overflow
  2007-11-19 15:15 ` Ben Warren
@ 2007-11-19 15:39   ` Shinya Kuribayashi
  0 siblings, 0 replies; 3+ messages in thread
From: Shinya Kuribayashi @ 2007-11-19 15:39 UTC (permalink / raw)
  To: u-boot

Ben Warren wrote:
> Shinya Kuribayashi wrote:
>> 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;
>>  
>>
>>   
> This looks harmless enough, but is in a place that is touched by every 
> board on every architecture, and the bug doesn't really seem to hurt 
> anything other than printing garbage. IMHO it should wait until the next 
> release. I will apply it to a 'for_1.3.1' branch of the net tree.

Ok, I'm afraid I have to wait. Thanks for your comment,

  Shinya

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-11-19 15:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-19 11:27 [U-Boot-Users] [PATCH] net/eth.c: Fix env_enetaddr signed overflow Shinya Kuribayashi
2007-11-19 15:15 ` Ben Warren
2007-11-19 15:39   ` Shinya Kuribayashi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox