* [PATCH BlueZ] Fix strict-aliasing rules handling for hciemu and IP ports
@ 2011-12-29 18:41 Anderson Lizardo
2011-12-30 11:11 ` Johan Hedberg
0 siblings, 1 reply; 2+ messages in thread
From: Anderson Lizardo @ 2011-12-29 18:41 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Anderson Lizardo
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1369 bytes --]
This fix is based on commit 97046eaf3fc44b4451157b1a1bbc166ab0f4dda8.
---
Due to some recent change, gcc 4.4.3 (from Ubuntu 10.04) started complaining
about this code:
test/hciemu.c: In function ‘hci_host_control’:
test/hciemu.c:431: error: dereferencing pointer ‘({anonymous})’ does break
strict-aliasing rules
test/hciemu.c:431: note: initialized from here
test/hciemu.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/test/hciemu.c b/test/hciemu.c
index ccd6cc3..7eb8814 100644
--- a/test/hciemu.c
+++ b/test/hciemu.c
@@ -428,7 +428,7 @@ static int scan_enable(uint8_t *data)
baswap(&ba, &vdev.bdaddr);
sa.sin_family = AF_INET;
memcpy(&sa.sin_addr.s_addr, &ba, sizeof(sa.sin_addr.s_addr));
- sa.sin_port = *(uint16_t *) &ba.b[4];
+ memcpy(&sa.sin_port, &ba.b[4], sizeof(sa.sin_port));
if (bind(sk, (struct sockaddr *) &sa, sizeof(sa))) {
syslog(LOG_ERR, "Can't bind socket: %s (%d)",
strerror(errno), errno);
@@ -541,7 +541,7 @@ do_connect:
baswap(&ba, &cp->bdaddr);
sa.sin_family = AF_INET;
memcpy(&sa.sin_addr.s_addr, &ba, sizeof(sa.sin_addr.s_addr));
- sa.sin_port = *(uint16_t *) &ba.b[4];
+ memcpy(&sa.sin_port, &ba.b[4], sizeof(sa.sin_port));
if (connect(sk, (struct sockaddr *) &sa, sizeof(sa)) < 0) {
syslog(LOG_ERR, "Can't connect: %s (%d)",
strerror(errno), errno);
--
1.7.0.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH BlueZ] Fix strict-aliasing rules handling for hciemu and IP ports
2011-12-29 18:41 [PATCH BlueZ] Fix strict-aliasing rules handling for hciemu and IP ports Anderson Lizardo
@ 2011-12-30 11:11 ` Johan Hedberg
0 siblings, 0 replies; 2+ messages in thread
From: Johan Hedberg @ 2011-12-30 11:11 UTC (permalink / raw)
To: Anderson Lizardo; +Cc: linux-bluetooth
Hi Lizardo,
On Thu, Dec 29, 2011, Anderson Lizardo wrote:
> This fix is based on commit 97046eaf3fc44b4451157b1a1bbc166ab0f4dda8.
> ---
>
> Due to some recent change, gcc 4.4.3 (from Ubuntu 10.04) started complaining
> about this code:
>
> test/hciemu.c: In function ‘hci_host_control’:
> test/hciemu.c:431: error: dereferencing pointer ‘({anonymous})’ does break
> strict-aliasing rules
> test/hciemu.c:431: note: initialized from here
>
>
> test/hciemu.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
Applied, but I had to move the stuff below --- to the actual commit
message since it's important to retain the reasons for the patches in
the git commit history.
Johan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-12-30 11:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-29 18:41 [PATCH BlueZ] Fix strict-aliasing rules handling for hciemu and IP ports Anderson Lizardo
2011-12-30 11:11 ` Johan Hedberg
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.