Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


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@klomp.org>


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.