Skip to contentSkip to conversation

PPC MPC83xx: Fix MPC8323ERDB build warning

PATCH Superseded Wolfgang Denk 5 participants 15 messages Jun 14, 2013 – Jul 16, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 PPC MPC83xx: Fix MPC8323ERDB build warning

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]

cc Michael Barkowski <[email protected]>
cc Kim Phillips <[email protected]>
---
 board/freescale/mpc8323erdb/mpc8323erdb.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
board/freescale/mpc8323erdb/mpc8323erdb.c +5 -1
index f29b2f4..533cb08 100644
@@ -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)) {
Signature · 1 line
1.7.11.7
#1 lore raw

PATCH 2/2 PPC MPC83xx: Fix MPC8323ERDB build warning

Dear Kim,

Quoted 7 lines · In message <[email protected]> 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]

cc Michael Barkowski <[email protected]>

The address of the board maintainer bounces:

| Delivery has failed to these recipients or groups:
| 
| Michael Barkowski
| (michael.barkowski at freescale.com)<mailto:[email protected]>
| 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

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The IQ of the group is the lowest IQ of a member of the group divided
by the number of people in the group.
#2 lore raw

PATCH 2/2 PPC MPC83xx: Fix MPC8323ERDB build warning

Quoted 25 lines · Wolfgang Denk

Dear Kim,

Quoted 7 lines · In message <[email protected]> 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]

cc Michael Barkowski <[email protected]>

The address of the board maintainer bounces:

| Delivery has failed to these recipients or groups:
|
| Michael Barkowski
| (michael.barkowski at freescale.com)<mailto:[email protected]
Quoted 1 line
| 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.
Quoted 3 lines

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

#3 lore raw

PATCH 2/2 PPC MPC83xx: Fix MPC8323ERDB build warning

Quoted 4 lines · Andy Fleming

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.

#4 lore raw

PATCH 2/2 PPC MPC83xx: Fix MPC8323ERDB build warning

Quoted 7 lines · Timur Tabi
Quoted 4 lines · Andy Fleming

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. :)

Quoted 6 lines

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

#5 lore raw

PATCH 2/2 PPC MPC83xx: Fix MPC8323ERDB build warning

In reply to Timur Tabi

Dear Timur Tabi,

Quoted 7 lines · In message <CAOZdJXWiKuGm5wOXQ5NwkPnBUgoEUSLOZPsbT1jJLn2c+M+kOw@mail.gmail.com>…
Quoted 4 lines · Andy Fleming

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. :)

Quoted 6 lines

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

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
This is now.  Later is later.
#6 lore raw

PATCH 2/2 PPC MPC83xx: Fix MPC8323ERDB build warning

In reply to Wolfgang Denk

Dear Kim,

ping!!

Quoted 33 lines · In message <[email protected]> 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]

cc Michael Barkowski <[email protected]>
cc Kim Phillips <[email protected]>
---
 board/freescale/mpc8323erdb/mpc8323erdb.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
board/freescale/mpc8323erdb/mpc8323erdb.c +5 -1
index f29b2f4..533cb08 100644
@@ -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)) {
Signature · 1 line
1.7.11.7

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Einstein argued that there must be simplified explanations of nature,
because God is not capricious or arbitrary. No  such  faith  comforts
the software engineer.                             - Fred Brooks, Jr.
#7 lore raw

PATCH 2/2 PPC MPC83xx: Fix MPC8323ERDB build warning

In reply to Wolfgang Denk

board/freescale/mpc8323erdb/mpc8323erdb.c int mac_read_from_eeprom(void) · line 198

Quoted 10 lines · Wolfgang Denk
board/freescale/mpc8323erdb/mpc8323erdb.c +1 -1
index f29b2f4..533cb08 100644
@@ -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,

#8 lore raw

PATCH v2 2/2 PPC MPC83xx: Fix MPC8323ERDB build warning

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]

cc Timur Tabi <[email protected]>
cc Kim Phillips <[email protected]>

---
V2: use uint32_t for crc_buf to make sure we always get exactly
32 bit; thanks to Timur Tabi for pointing out.

 board/freescale/mpc8323erdb/mpc8323erdb.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
board/freescale/mpc8323erdb/mpc8323erdb.c +5 -1
index f29b2f4..533cb08 100644
@@ -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]) {
+		uint32_t 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)) {
Signature · 1 line
1.7.11.7
#9 lore raw

PATCH v2 2/2 PPC MPC83xx: Fix MPC8323ERDB build warning

board/freescale/mpc8323erdb/mpc8323erdb.c int mac_read_from_eeprom(void) · line 200

Quoted 3 lines · Wolfgang Denk
board/freescale/mpc8323erdb/mpc8323erdb.c +3 -0
+		uint32_t crc_buf;
+
+		memcpy(&crc_buf, &buf[24], sizeof(unsigned int));

Well, this is wrong, because it should be sizeof(uint32_t). Or maybe sizeof(crc_buf).

Signature · 1 line
Timur Tabi
#10 lore raw

PATCH v2 2/2 PPC MPC83xx: Fix MPC8323ERDB build warning

Dear Timur Tabi,

Quoted 7 lines · In message <[email protected]> you wrote:

board/freescale/mpc8323erdb/mpc8323erdb.c int mac_read_from_eeprom(void) · line 200

Quoted 3 lines · Wolfgang Denk
board/freescale/mpc8323erdb/mpc8323erdb.c +3 -0
+		uint32_t crc_buf;
+
+		memcpy(&crc_buf, &buf[24], sizeof(unsigned int));

Well, this is wrong, because it should be sizeof(uint32_t). Or maybe sizeof(crc_buf).

Indedd. Sorry. V3 on the way.

Thanks!

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Your own mileage may vary.
#11 lore raw

PATCH v2 2/2 PPC MPC83xx: Fix MPC8323ERDB build warning

In reply to Timur Tabi

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]

cc Timur Tabi <[email protected]>
cc Kim Phillips <[email protected]>

---
V2: use uint32_t for crc_buf to make sure we always get exactly
32 bit; thanks to Timur Tabi for pointing out.

 board/freescale/mpc8323erdb/mpc8323erdb.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
board/freescale/mpc8323erdb/mpc8323erdb.c +5 -1
index f29b2f4..533cb08 100644
@@ -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]) {
+		uint32_t 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)) {
Signature · 1 line
1.7.11.7
#12 lore raw

PATCH v3 2/2 PPC MPC83xx: Fix MPC8323ERDB build warning

In reply to Timur Tabi

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]

cc Timur Tabi <[email protected]>
cc Kim Phillips <[email protected]>

---
V2: use uint32_t for crc_buf to make sure we always get exactly
32 bit; thanks to Timur Tabi for pointing out.
V3: also use uint32_t for the size of the memcpy(), again thanks to
Timur Tabi for pointing out.

 board/freescale/mpc8323erdb/mpc8323erdb.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
board/freescale/mpc8323erdb/mpc8323erdb.c +5 -1
index f29b2f4..533cb08 100644
@@ -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]) {
+		uint32_t crc_buf;
+
+		memcpy(&crc_buf, &buf[24], sizeof(uint32_t));
+
+		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)) {
Signature · 1 line
1.7.11.7
#13 lore raw

PATCH v3 2/2 PPC MPC83xx: Fix MPC8323ERDB build warning

Quoted 7 lines · Wolfgang Denk

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

cc Timur Tabi<[email protected]>
cc Kim Phillips<[email protected]>

Ack.

Signature · 1 line
Timur Tabi
#14 lore raw

PATCH v3 2/2 PPC MPC83xx: Fix MPC8323ERDB build warning

In reply to Wolfgang Denk
Quoted 9 lines · Wolfgang Denk

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]

cc Timur Tabi <[email protected]>
cc Kim Phillips <[email protected]>

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130716/ef70527b/attachment.pgp>