* [PATCH] Bluetooth: Fix warning of uninitialized adv_instance variable
@ 2015-06-18 17:26 Johan Hedberg
2015-06-18 17:44 ` Marcel Holtmann
0 siblings, 1 reply; 2+ messages in thread
From: Johan Hedberg @ 2015-06-18 17:26 UTC (permalink / raw)
To: linux-bluetooth
From: Johan Hedberg <johan.hedberg@intel.com>
Some static checkers may cause the following (false positive) warning:
>> net/bluetooth/mgmt.c:7294:29: warning: 'adv_instance' may be used
uninitialized in this function [-Wuninitialized]
Fix it by ensuring adv_instance always gets set to a known value.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
---
net/bluetooth/mgmt.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 2fe6f3bfc579..2b3411136d68 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -7291,8 +7291,10 @@ static int remove_advertising(struct sock *sk, struct hci_dev *hdev,
if (cp->instance)
adv_instance = hci_find_adv_instance(hdev, cp->instance);
+ else
+ adv_instance = NULL;
- if (!(cp->instance == 0x00 || adv_instance)) {
+ if (!adv_instance) {
err = mgmt_cmd_status(sk, hdev->id,
MGMT_OP_REMOVE_ADVERTISING,
MGMT_STATUS_INVALID_PARAMS);
--
2.4.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Bluetooth: Fix warning of uninitialized adv_instance variable
2015-06-18 17:26 [PATCH] Bluetooth: Fix warning of uninitialized adv_instance variable Johan Hedberg
@ 2015-06-18 17:44 ` Marcel Holtmann
0 siblings, 0 replies; 2+ messages in thread
From: Marcel Holtmann @ 2015-06-18 17:44 UTC (permalink / raw)
To: Johan Hedberg; +Cc: linux-bluetooth
Hi Johan,
> Some static checkers may cause the following (false positive) warning:
>
>>> net/bluetooth/mgmt.c:7294:29: warning: 'adv_instance' may be used
> uninitialized in this function [-Wuninitialized]
>
> Fix it by ensuring adv_instance always gets set to a known value.
>
> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
> ---
> net/bluetooth/mgmt.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
patch has been applied to bluetooth-next tree.
Regards
Marcel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-06-18 17:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-18 17:26 [PATCH] Bluetooth: Fix warning of uninitialized adv_instance variable Johan Hedberg
2015-06-18 17:44 ` Marcel Holtmann
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.