diff mbox

[U-Boot,2/2] PPC MPC83xx: Fix MPC8323ERDB build warning

Message ID 1371198068-3581-1-git-send-email-wd@denx.de
State Superseded
Delegated to: Wolfgang Denk
Headers show

Commit Message

Wolfgang Denk June 14, 2013, 8:21 a.m. UTC
Fix:

mpc8323erdb.c: In function 'mac_read_from_eeprom':
mpc8323erdb.c:198:3: warning: dereferencing type-punned pointer will
break strict-aliasing rules [-Wstrict-aliasing]

Signed-off-by: Wolfgang Denk <wd@denx.de>
cc: Michael Barkowski <michael.barkowski@freescale.com>
cc: Kim Phillips <kim.phillips@freescale.com>
---
 board/freescale/mpc8323erdb/mpc8323erdb.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Wolfgang Denk June 14, 2013, 9:14 a.m. UTC | #1
Dear Kim,

In message <1371198068-3581-1-git-send-email-wd@denx.de> you wrote:
> 
> mpc8323erdb.c: In function 'mac_read_from_eeprom':
> mpc8323erdb.c:198:3: warning: dereferencing type-punned pointer will
> break strict-aliasing rules [-Wstrict-aliasing]
> 
> Signed-off-by: Wolfgang Denk <wd@denx.de>
> cc: Michael Barkowski <michael.barkowski@freescale.com>

The address of the board maintainer bounces:

| Delivery has failed to these recipients or groups:
| 
| Michael Barkowski
| (michael.barkowski@freescale.com)<mailto:michael.barkowski@freescale.com>
| The e-mail address you entered couldn't be found. Please check the
| recipient's e-mail address and try to resend the message. If the
| problem continues, please contact your helpdesk.
| 
| The following organization rejected your message:
| tx30smr01.am.freescale.net.

Do you know if there is a new maintainer for this board, or should
we enter it as orphaned?

Best regards,

Wolfgang Denk
Wolfgang Denk June 27, 2013, 6:22 a.m. UTC | #2
Dear Kim,

ping!!

In message <1371198068-3581-1-git-send-email-wd@denx.de> I wrote:
> Fix:
> 
> mpc8323erdb.c: In function 'mac_read_from_eeprom':
> mpc8323erdb.c:198:3: warning: dereferencing type-punned pointer will
> break strict-aliasing rules [-Wstrict-aliasing]
> 
> Signed-off-by: Wolfgang Denk <wd@denx.de>
> cc: Michael Barkowski <michael.barkowski@freescale.com>
> cc: Kim Phillips <kim.phillips@freescale.com>
> ---
>  board/freescale/mpc8323erdb/mpc8323erdb.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/board/freescale/mpc8323erdb/mpc8323erdb.c b/board/freescale/mpc8323erdb/mpc8323erdb.c
> index f29b2f4..533cb08 100644
> --- a/board/freescale/mpc8323erdb/mpc8323erdb.c
> +++ b/board/freescale/mpc8323erdb/mpc8323erdb.c
> @@ -195,7 +195,11 @@ int mac_read_from_eeprom(void)
>  		printf("\nEEPROM @ 0x%02x read FAILED!!!\n",
>  		       CONFIG_SYS_I2C_EEPROM_ADDR);
>  	} else {
> -		if (crc32(crc, buf, 24) == *(unsigned int *)&buf[24]) {
> +		unsigned int crc_buf;
> +
> +		memcpy(&crc_buf, &buf[24], sizeof(unsigned int));
> +
> +		if (crc32(crc, buf, 24) == crc_buf) {
>  			printf("Reading MAC from EEPROM\n");
>  			for (i = 0; i < 4; i++) {
>  				if (memcmp(&buf[i * 6], "\0\0\0\0\0\0", 6)) {
> -- 
> 1.7.11.7
> 

Best regards,

Wolfgang Denk
Andy Fleming June 28, 2013, 9:47 p.m. UTC | #3
On Fri, Jun 14, 2013 at 4:14 AM, Wolfgang Denk <wd@denx.de> wrote:

> Dear Kim,
>
> In message <1371198068-3581-1-git-send-email-wd@denx.de> you wrote:
> >
> > mpc8323erdb.c: In function 'mac_read_from_eeprom':
> > mpc8323erdb.c:198:3: warning: dereferencing type-punned pointer will
> > break strict-aliasing rules [-Wstrict-aliasing]
> >
> > Signed-off-by: Wolfgang Denk <wd@denx.de>
> > cc: Michael Barkowski <michael.barkowski@freescale.com>
>
> The address of the board maintainer bounces:
>
> | Delivery has failed to these recipients or groups:
> |
> | Michael Barkowski
> | (michael.barkowski@freescale.com)<mailto:michael.barkowski@freescale.com
> >
> | The e-mail address you entered couldn't be found. Please check the
> | recipient's e-mail address and try to resend the message. If the
> | problem continues, please contact your helpdesk.
> |
> | The following organization rejected your message:
> | tx30smr01.am.freescale.net.
>
> Do you know if there is a new maintainer for this board, or should
> we enter it as orphaned?
>



Well, he hasn't been at Freescale for years, now, so that's not surprising.
It's not entirely clear to me whether that board is one we actively
support, but I suspect we can get away with maintenance moving over to Kim.
That said, I guess I shouldn't volunteer him. :)

Andy
Timur Tabi June 29, 2013, 4:11 a.m. UTC | #4
On Fri, Jun 28, 2013 at 4:47 PM, Andy Fleming <afleming@gmail.com> wrote:

> Well, he hasn't been at Freescale for years, now, so that's not surprising.
> It's not entirely clear to me whether that board is one we actively
> support, but I suspect we can get away with maintenance moving over to Kim.
> That said, I guess I shouldn't volunteer him. :)

There's been a lot of churn at Freescale over the past couple years.
I think a lot of the email addresses are no longer valid.  It's
probably time for an update.

For the record, I actually have an mpc8323erdb.  I'm not sure if I
want to be the maintainer for it, though.
Sinan Akman June 29, 2013, 6:04 a.m. UTC | #5
On 06/29/2013 12:11 AM, Timur Tabi wrote:
> On Fri, Jun 28, 2013 at 4:47 PM, Andy Fleming <afleming@gmail.com> wrote:
>
>> Well, he hasn't been at Freescale for years, now, so that's not surprising.
>> It's not entirely clear to me whether that board is one we actively
>> support, but I suspect we can get away with maintenance moving over to Kim.
>> That said, I guess I shouldn't volunteer him. :)
>
> There's been a lot of churn at Freescale over the past couple years.
> I think a lot of the email addresses are no longer valid.  It's
> probably time for an update.
>
> For the record, I actually have an mpc8323erdb.  I'm not sure if I
> want to be the maintainer for it, though.

   I have that board too and can run regular tests if that is
any help

   -- sinan
Wolfgang Denk July 4, 2013, 6:15 a.m. UTC | #6
Dear Timur Tabi,

In message <CAOZdJXWiKuGm5wOXQ5NwkPnBUgoEUSLOZPsbT1jJLn2c+M+kOw@mail.gmail.com> you wrote:
> On Fri, Jun 28, 2013 at 4:47 PM, Andy Fleming <afleming@gmail.com> wrote:
> 
> > Well, he hasn't been at Freescale for years, now, so that's not surprising.
> > It's not entirely clear to me whether that board is one we actively
> > support, but I suspect we can get away with maintenance moving over to Kim.
> > That said, I guess I shouldn't volunteer him. :)
> 
> There's been a lot of churn at Freescale over the past couple years.
> I think a lot of the email addresses are no longer valid.  It's
> probably time for an update.
> 
> For the record, I actually have an mpc8323erdb.  I'm not sure if I
> want to be the maintainer for it, though.

Well, while you're discussing a potential new maintainer for this
board, can please anybody ACK/NAK or - even better - pull that patch
so we can fix the build warnings for the release?

Thanks.

Best regards,

Wolfgang Denk
Timur Tabi July 4, 2013, 12:57 p.m. UTC | #7
On Fri, Jun 14, 2013 at 3:21 AM, Wolfgang Denk <wd@denx.de> wrote:

> diff --git a/board/freescale/mpc8323erdb/mpc8323erdb.c b/board/freescale/mpc8323erdb/mpc8323erdb.c
> index f29b2f4..533cb08 100644
> --- a/board/freescale/mpc8323erdb/mpc8323erdb.c
> +++ b/board/freescale/mpc8323erdb/mpc8323erdb.c
> @@ -195,7 +195,11 @@ int mac_read_from_eeprom(void)
>                 printf("\nEEPROM @ 0x%02x read FAILED!!!\n",
>                        CONFIG_SYS_I2C_EEPROM_ADDR);
>         } else {
> -               if (crc32(crc, buf, 24) == *(unsigned int *)&buf[24]) {
> +               unsigned int crc_buf;

This should be a uint32_t, because you specifically want only four bytes.

If you fix that,

Acked-by: Timur Tabi <timur@tabi.org>
diff mbox

Patch

diff --git a/board/freescale/mpc8323erdb/mpc8323erdb.c b/board/freescale/mpc8323erdb/mpc8323erdb.c
index f29b2f4..533cb08 100644
--- a/board/freescale/mpc8323erdb/mpc8323erdb.c
+++ b/board/freescale/mpc8323erdb/mpc8323erdb.c
@@ -195,7 +195,11 @@  int mac_read_from_eeprom(void)
 		printf("\nEEPROM @ 0x%02x read FAILED!!!\n",
 		       CONFIG_SYS_I2C_EEPROM_ADDR);
 	} else {
-		if (crc32(crc, buf, 24) == *(unsigned int *)&buf[24]) {
+		unsigned int crc_buf;
+
+		memcpy(&crc_buf, &buf[24], sizeof(unsigned int));
+
+		if (crc32(crc, buf, 24) == crc_buf) {
 			printf("Reading MAC from EEPROM\n");
 			for (i = 0; i < 4; i++) {
 				if (memcmp(&buf[i * 6], "\0\0\0\0\0\0", 6)) {