[PATCH] valgrind: Initialize all of struct sockaddr_rc for binding A...
Mark Wielaard (via Code Review)
gerrit at gerrit.libreoffice.org
Tue May 21 16:03:45 PDT 2013
Hi,
I have submitted a patch for review:
https://gerrit.libreoffice.org/3998
To pull it, you can do:
git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/98/3998/1
valgrind: Initialize all of struct sockaddr_rc for binding AF_BLUETOOTH.
valgrind doesn't know that struct sockaddr_rc contains some padding that
isn't used. Since we pass bind sizeof (struct sockaddr_rc) valgrind will
check all bytes are initialized. So explicitly clear all bytes before
passing to bind.
https://bugs.kde.org/show_bug.cgi?id=320116 tracks adding explicit
support to valgrind.
Change-Id: I05d2f221a5794228dae3077e8ea1bcda5ba1f8b0
---
M sd/source/ui/remotecontrol/BluetoothServer.cxx
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/sd/source/ui/remotecontrol/BluetoothServer.cxx b/sd/source/ui/remotecontrol/BluetoothServer.cxx
index c87f1b8..f5426d8 100644
--- a/sd/source/ui/remotecontrol/BluetoothServer.cxx
+++ b/sd/source/ui/remotecontrol/BluetoothServer.cxx
@@ -224,9 +224,13 @@
}
sockaddr_rc aAddr;
+ // Initialize whole structure. Mainly to appease valgrind, which
+ // doesn't know about the padding at the end of sockaddr_rc which
+ // it will dutifully check for definedness. But also the standard
+ // definition of BDADDR_ANY is unusable in C++ code, so just use
+ // memset to set aAddr.rc_bdaddr to 0.
+ memset( &aAddr, 0, sizeof( aAddr ) );
aAddr.rc_family = AF_BLUETOOTH;
- // BDADDR_ANY is broken, so use memset to set to 0.
- memset( &aAddr.rc_bdaddr, 0, sizeof( aAddr.rc_bdaddr ) );
aAddr.rc_channel = 5;
int a;
--
To view, visit https://gerrit.libreoffice.org/3998
To unsubscribe, visit https://gerrit.libreoffice.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I05d2f221a5794228dae3077e8ea1bcda5ba1f8b0
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Mark Wielaard <mark at klomp.org>
More information about the LibreOffice
mailing list