* [PATCH BlueZ] service: Fix passing stack variable as reference value
@ 2012-10-08 20:08 Luiz Augusto von Dentz
2012-10-09 8:53 ` Johan Hedberg
0 siblings, 1 reply; 2+ messages in thread
From: Luiz Augusto von Dentz @ 2012-10-08 20:08 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
BDADDR_ANY cannot be return as it uses stack allocation:
Conditional jump or move depends on uninitialised value(s)
at 0x170E47: sdp_record_remove (sdpd-database.c:269)
by 0x17071A: remove_record_from_server (sdpd-service.c:290)
by 0x14D416: exit_callback (service.c:131)
by 0x124396: service_filter (watch.c:486)
by 0x12405A: message_filter (watch.c:554)
by 0x4F63A35: dbus_connection_dispatch (in /usr/lib64/libdbus-1.so.3.5.6)
by 0x122EE7: message_dispatch (mainloop.c:76)
by 0x4C7B3BA: ??? (in /usr/lib64/libglib-2.0.so.0.3200.4)
by 0x4C7A824: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.3200.4)
by 0x4C7AB57: ??? (in /usr/lib64/libglib-2.0.so.0.3200.4)
by 0x4C7AF51: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.3200.4)
by 0x1225B1: main (main.c:551)
Uninitialised value was created by a stack allocation
at 0x1705B0: add_record_to_server (sdpd-service.c:235)
Conditional jump or move depends on uninitialised value(s)
at 0x4A0AD21: bcmp (mc_replace_strmem.c:889)
by 0x4C959E0: g_slist_find_custom (in /usr/lib64/libglib-2.0.so.0.3200.4)
by 0x17C059: manager_find_adapter (manager.c:291)
by 0x170E8F: sdp_record_remove (sdpd-database.c:270)
by 0x17071A: remove_record_from_server (sdpd-service.c:290)
by 0x14D416: exit_callback (service.c:131)
by 0x124396: service_filter (watch.c:486)
by 0x12405A: message_filter (watch.c:554)
by 0x4F63A35: dbus_connection_dispatch (in /usr/lib64/libdbus-1.so.3.5.6)
by 0x122EE7: message_dispatch (mainloop.c:76)
by 0x4C7B3BA: ??? (in /usr/lib64/libglib-2.0.so.0.3200.4)
by 0x4C7A824: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.3200.4)
Uninitialised value was created by a stack allocation
at 0x1705B0: add_record_to_server (sdpd-service.c:235)
---
plugins/service.c | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/plugins/service.c b/plugins/service.c
index cea36e0..eebacc5 100644
--- a/plugins/service.c
+++ b/plugins/service.c
@@ -45,6 +45,8 @@
#include "log.h"
#define SERVICE_INTERFACE "org.bluez.Service"
+#define get_address(adp) \
+ (adp->adapter ? adapter_get_address(adp->adapter) : BDADDR_ANY)
struct record_data {
uint32_t handle;
@@ -134,14 +136,6 @@ static void exit_callback(DBusConnection *conn, void *user_data)
g_free(user_record);
}
-static const bdaddr_t *get_address(struct service_adapter *serv_adapter)
-{
- if (serv_adapter->adapter)
- return adapter_get_address(serv_adapter->adapter);
-
- return BDADDR_ANY;
-}
-
static int add_xml_record(const char *sender,
struct service_adapter *serv_adapter,
const char *record, dbus_uint32_t *handle)
--
1.7.11.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH BlueZ] service: Fix passing stack variable as reference value
2012-10-08 20:08 [PATCH BlueZ] service: Fix passing stack variable as reference value Luiz Augusto von Dentz
@ 2012-10-09 8:53 ` Johan Hedberg
0 siblings, 0 replies; 2+ messages in thread
From: Johan Hedberg @ 2012-10-09 8:53 UTC (permalink / raw)
To: Luiz Augusto von Dentz; +Cc: linux-bluetooth
Hi Luiz,
On Mon, Oct 08, 2012, Luiz Augusto von Dentz wrote:
> BDADDR_ANY cannot be return as it uses stack allocation:
>
> Conditional jump or move depends on uninitialised value(s)
> at 0x170E47: sdp_record_remove (sdpd-database.c:269)
> by 0x17071A: remove_record_from_server (sdpd-service.c:290)
> by 0x14D416: exit_callback (service.c:131)
> by 0x124396: service_filter (watch.c:486)
> by 0x12405A: message_filter (watch.c:554)
> by 0x4F63A35: dbus_connection_dispatch (in /usr/lib64/libdbus-1.so.3.5.6)
> by 0x122EE7: message_dispatch (mainloop.c:76)
> by 0x4C7B3BA: ??? (in /usr/lib64/libglib-2.0.so.0.3200.4)
> by 0x4C7A824: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.3200.4)
> by 0x4C7AB57: ??? (in /usr/lib64/libglib-2.0.so.0.3200.4)
> by 0x4C7AF51: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.3200.4)
> by 0x1225B1: main (main.c:551)
> Uninitialised value was created by a stack allocation
> at 0x1705B0: add_record_to_server (sdpd-service.c:235)
>
> Conditional jump or move depends on uninitialised value(s)
> at 0x4A0AD21: bcmp (mc_replace_strmem.c:889)
> by 0x4C959E0: g_slist_find_custom (in /usr/lib64/libglib-2.0.so.0.3200.4)
> by 0x17C059: manager_find_adapter (manager.c:291)
> by 0x170E8F: sdp_record_remove (sdpd-database.c:270)
> by 0x17071A: remove_record_from_server (sdpd-service.c:290)
> by 0x14D416: exit_callback (service.c:131)
> by 0x124396: service_filter (watch.c:486)
> by 0x12405A: message_filter (watch.c:554)
> by 0x4F63A35: dbus_connection_dispatch (in /usr/lib64/libdbus-1.so.3.5.6)
> by 0x122EE7: message_dispatch (mainloop.c:76)
> by 0x4C7B3BA: ??? (in /usr/lib64/libglib-2.0.so.0.3200.4)
> by 0x4C7A824: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.3200.4)
> Uninitialised value was created by a stack allocation
> at 0x1705B0: add_record_to_server (sdpd-service.c:235)
> ---
> plugins/service.c | 10 ++--------
> 1 file changed, 2 insertions(+), 8 deletions(-)
Applied. Thanks.
Johan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-10-09 8:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-08 20:08 [PATCH BlueZ] service: Fix passing stack variable as reference value Luiz Augusto von Dentz
2012-10-09 8:53 ` Johan Hedberg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).