Bluetooth: Fix warning of uninitialized adv_instance variable
Subsystems (2)
PATCH 1/1 Bluetooth: Fix warning of uninitialized adv_instance variable
From: Johan Hedberg <[email protected]>
Some static checkers may cause the following (false positive) warning:
Quoted 1 line
Quoted 1 line
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 <[email protected]>
--- net/bluetooth/mgmt.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/bluetooth/mgmt.c +3 -1
@@ -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 );
Signature · 1 line
2.4.3
Marcel Holtmann
maintainerHi Johan,
Quoted 11 lines
Some static checkers may cause the following (false positive) warning:
Quoted 1 line
Quoted 1 line
net/bluetooth/mgmt.c:7294:29: warning: 'adv_instance' may be useduninitialized in this function [-Wuninitialized]
Fix it by ensuring
adv_instancealways gets set to a known value.Signed-off-by Johan Hedberg <[email protected]>---
net/bluetooth/mgmt.c| 4 +++-1 file changed, 3 insertions(+), 1 deletion(-)
patch has been applied to bluetooth-next tree.
Regards
Marcel