2012-03-07 18:20:14

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: [PATCH] Bluetooth: Fix using uninitialized variable

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

+ src/net/bluetooth/rfcomm/tty.c: warning: 'p' is used uninitialized in this
function: => 218
+ src/net/bluetooth/rfcomm/tty.c: warning: 'p' may be used uninitialized in
this function: => 218

Signed-off-by: Luiz Augusto von Dentz <[email protected]>
---
net/bluetooth/rfcomm/tty.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c
index a2d4f51..c179734 100644
--- a/net/bluetooth/rfcomm/tty.c
+++ b/net/bluetooth/rfcomm/tty.c
@@ -196,7 +196,7 @@ static DEVICE_ATTR(channel, S_IRUGO, show_channel, NULL);
static int rfcomm_dev_add(struct rfcomm_dev_req *req, struct rfcomm_dlc *dlc)
{
struct rfcomm_dev *dev, *entry;
- struct list_head *head = &rfcomm_dev_list, *p;
+ struct list_head *head = &rfcomm_dev_list;
int err = 0;

BT_DBG("id %d channel %d", req->dev_id, req->channel);
@@ -215,7 +215,7 @@ static int rfcomm_dev_add(struct rfcomm_dev_req *req, struct rfcomm_dlc *dlc)
break;

dev->id++;
- head = p;
+ head = &entry->list;
}
} else {
dev->id = req->dev_id;
@@ -229,7 +229,7 @@ static int rfcomm_dev_add(struct rfcomm_dev_req *req, struct rfcomm_dlc *dlc)
if (entry->id > dev->id - 1)
break;

- head = p;
+ head = &entry->list;
}
}

--
1.7.7.6



2012-03-08 05:20:12

by Gustavo Padovan

[permalink] [raw]
Subject: Re: [PATCH] Bluetooth: Fix using uninitialized variable

Hi Luiz,

* Luiz Augusto von Dentz <[email protected]> [2012-03-07 20:20:14 +0200]:

> From: Luiz Augusto von Dentz <[email protected]>
>
> + src/net/bluetooth/rfcomm/tty.c: warning: 'p' is used uninitialized in this
> function: => 218
> + src/net/bluetooth/rfcomm/tty.c: warning: 'p' may be used uninitialized in
> this function: => 218
>
> Signed-off-by: Luiz Augusto von Dentz <[email protected]>
> ---
> net/bluetooth/rfcomm/tty.c | 6 +++---
> 1 files changed, 3 insertions(+), 3 deletions(-)

Is this a new gcc warning? I've never saw it before.

Patch is applied, thanks.

Gustavo