Thread (3 messages) flat view 3 messages, 2 authors, 2014-06-01

Re: [PATCH] net: bluetooth: hci_core.c: Cleaning up uninitialized variables

From: Marcel Holtmann <marcel@holtmann.org>
Date: 2014-06-01 14:24:28
Also in: linux-bluetooth, lkml

Hi Rickard,
quoted hunk ↗ jump to hunk
There is a risk that the variable will be used without being initialized.

This was largely found by using a static code analysis program called cppcheck.

Signed-off-by: Rickard Strandqvist <redacted>
---
net/bluetooth/hci_core.c |    2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 1c6ffaa..1d93d2f 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -4603,7 +4603,7 @@ static struct hci_chan *hci_chan_sent(struct hci_dev *hdev, __u8 type,
	struct hci_chan *chan = NULL;
	unsigned int num = 0, min = ~0, cur_prio = 0;
	struct hci_conn *conn;
-	int cnt, q, conn_num = 0;
+	int cnt, q = 0, conn_num = 0;
I have no idea on how the variable will be used without being initialized. Have you actually looked through that function. The only thing we do with q is assign it and then use it. That is it.

Regards

Marcel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help