net: tsec - fix dereferencing type-punned pointer will break strict-aliasing rules warning
PATCH 1/1 net: tsec - fix dereferencing type-punned pointer will break strict-aliasing rules warning
fix this gcc 4.4 warning:
tsec.c: In function 'tsec_init':
tsec.c:200: warning: dereferencing type-punned pointer will break strict-aliasing rules
--- drivers/net/tsec.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
drivers/net/tsec.c +4 -1
@@ -197,7 +197,10 @@ int tsec_init(struct eth_device *dev, bd_t * bd)for (i =0 ; i <MAC_ADDR_LEN ; i++) { tmpbuf[MAC_ADDR_LEN -1 - i] = dev->enetaddr[i]; } - regs->macstnaddr1 = *((uint *) (tmpbuf)); + tempval = (tmpbuf[3 ] <<24 ) | (tmpbuf[2 ] <<16 ) | (tmpbuf[1 ] <<8 ) | + tmpbuf[0 ]; + + regs->macstnaddr1 = tempval; tempval = *((uint *) (tmpbuf +4 ));
Signature · 1 line
1.6.3.2
Ben Warren
AppliedPATCH 1/1 net: tsec - fix dereferencing type-punned pointer will break strict-aliasing rules warning
Quoted 17 lines · Kim Phillips
fix this gcc 4.4 warning:
tsec.c: In function 'tsec_init':
tsec.c:200: warning: dereferencing type-punned pointer will break strict-aliasing rulesSigned-off-by Kim Phillips <[email protected]>--- drivers/net/tsec.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)drivers/net/tsec.c +0
-0@@ -197,7 +197,10 @@ int tsec_init(struct eth_device *dev, bd_t * bd)for (i =0 ; i <MAC_ADDR_LEN ; i++) {
drivers/net/tsec.c int tsec_init(struct eth_device *dev, bd_t * bd) · line 206
Quoted 10 lines
drivers/net/tsec.c +4
-1tmpbuf[MAC_ADDR_LEN -1 - i] = dev->enetaddr[i]; } - regs->macstnaddr1 = *((uint *) (tmpbuf)); + tempval = (tmpbuf[3 ] <<24 ) | (tmpbuf[2 ] <<16 ) | (tmpbuf[1 ] <<8 ) | + tmpbuf[0 ]; + + regs->macstnaddr1 = tempval; tempval = *((uint *) (tmpbuf +4 ));
Applied to net repo.
thanks,
Ben
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH v2 1/1 net: tsec - fix dereferencing type-punned pointer will break strict-aliasing rules warning
fix this gcc 4.4 warning:
tsec.c: In function 'tsec_init':
tsec.c:200: warning: dereferencing type-punned pointer will break strict-aliasing rules
---
this is the endian-correct version
drivers/net/tsec.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
drivers/net/tsec.c +4 -1
@@ -197,7 +197,10 @@ int tsec_init(struct eth_device *dev, bd_t * bd)for (i =0 ; i <MAC_ADDR_LEN ; i++) { tmpbuf[MAC_ADDR_LEN -1 - i] = dev->enetaddr[i]; } - regs->macstnaddr1 = *((uint *) (tmpbuf)); + tempval = (tmpbuf[0 ] <<24 ) | (tmpbuf[1 ] <<16 ) | (tmpbuf[2 ] <<8 ) | + tmpbuf[3 ]; + + regs->macstnaddr1 = tempval; tempval = *((uint *) (tmpbuf +4 ));
Signature · 1 line
1.6.3.3
Ben Warren
AppliedPATCH v2 1/1 net: tsec - fix dereferencing type-punned pointer will break strict-aliasing rules warning
Kim,
Quoted 19 lines · Kim Phillips
fix this gcc 4.4 warning:
tsec.c: In function 'tsec_init':
tsec.c:200: warning: dereferencing type-punned pointer will break strict-aliasing rulesSigned-off-by Kim Phillips <[email protected]>---
this is the endian-correct versiondrivers/net/tsec.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)drivers/net/tsec.c +0
-0@@ -197,7 +197,10 @@ int tsec_init(struct eth_device *dev, bd_t * bd)for (i =0 ; i <MAC_ADDR_LEN ; i++) {
drivers/net/tsec.c int tsec_init(struct eth_device *dev, bd_t * bd) · line 206
Quoted 10 lines
drivers/net/tsec.c +4
-1tmpbuf[MAC_ADDR_LEN -1 - i] = dev->enetaddr[i]; } - regs->macstnaddr1 = *((uint *) (tmpbuf)); + tempval = (tmpbuf[0 ] <<24 ) | (tmpbuf[1 ] <<16 ) | (tmpbuf[2 ] <<8 ) | + tmpbuf[3 ]; + + regs->macstnaddr1 = tempval; tempval = *((uint *) (tmpbuf +4 ));
Applied to net repo.
thanks,
Ben