Skip to contentSkip to conversation

Fix uninitialized variable warning

PATCH In review [email protected] 2 participants 3 messages Mar 29, 2011 Bluetooth drivers

lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

PATCH v2 2/3 Fix uninitialized variable warning

From: Luiz Augusto von Dentz <[email protected]>

health/mcap.c: In function ‘proc_req_pending’:
health/mcap.c:1119:25: error: ‘abrt’ may be used uninitialized in this function make[1]: *** [health/mcap.o] Error 1

---
 health/mcap.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
health/mcap.c +1 -0
index 81fd8df..48866d4 100644
@@ -1126,6 +1126,7 @@ static void process_md_abort_mdl_req(struct mcap_mcl *mcl, void *cmd,
 	req = cmd;
 	mdl_id = ntohs(req->mdl);
 	mcl->state = MCL_CONNECTED;
+	abrt = NULL;
 	for (l = mcl->mdls; l; l = l->next) {
 		mdl = l->data;
 		if (mdl_id == mdl->mdlid && mdl->state == MDL_WAITING) {
Signature · 1 line
1.7.4.1
author maintainer
#1 lore raw

PATCH v2 3/3 Fix uninitialized variables warnings

From: Luiz Augusto von Dentz <[email protected]>

src/attrib-server.c: In function ‘channel_handler’:
src/attrib-server.c:297:21: error: ‘cur’ may be used uninitialized in this function src/attrib-server.c:502:10: error: ‘format’ may be used uninitialized in this function src/attrib-server.c:503:11: error: ‘length’ may be used uninitialized in this function make[1]: *** [src/attrib-server.o] Error 1

---
 src/attrib-server.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
src/attrib-server.c +4 -1
index dc05d7e..98bd6b1 100644
@@ -315,7 +315,7 @@ static uint16_t read_by_group(struct gatt_channel *channel, uint16_t start,
 					ATT_ECODE_UNSUPP_GRP_TYPE, pdu, len);
 
 	last_handle = end;
-	for (l = database, groups = NULL; l; l = l->next) {
+	for (l = database, groups = NULL, cur = NULL; l; l = l->next) {
 		struct attribute *client_attr;
 
 		a = l->data;
@@ -538,6 +538,9 @@ static int find_info(uint16_t start, uint16_t end, uint8_t *pdu, int len)
 	} else if (last_type == BT_UUID128) {
 		length = 16;
 		format = 0x02;
+	} else {
+		g_slist_free(info);
+		return 0;
 	}
 
 	adl = att_data_list_alloc(num, length + 2);
Signature · 1 line
1.7.4.1
#2 lore raw

Re: [PATCH 3/3 v2] Fix uninitialized variables warnings

Hi Luiz,

Quoted 8 lines · On Tue, Mar 29, 2011, [email protected] wrote:

src/attrib-server.c: In function ‘channel_handler’:
src/attrib-server.c:297:21: error: ‘cur’ may be used uninitialized in this function src/attrib-server.c:502:10: error: ‘format’ may be used uninitialized in this function src/attrib-server.c:503:11: error: ‘length’ may be used uninitialized in this function make[1]: *** [src/attrib-server.o] Error 1

---
 src/attrib-server.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

All three patches (v2 of 2/3 & 3/3) have been pushed upstream. Thanks.

Johan