Commit a27c519
Bluetooth: fix uninitialized variables notify_evt
Coverity Scan report:
[...]
*** CID 1493985: Uninitialized variables (UNINIT)
/net/bluetooth/hci_event.c: 4535 in hci_sync_conn_complete_evt()
4529
4530 /* Notify only in case of SCO over HCI transport data path which
4531 * is zero and non-zero value shall be non-HCI transport data path
4532 */
4533 if (conn->codec.data_path == 0) {
4534 if (hdev->notify)
>>> CID 1493985: Uninitialized variables (UNINIT)
>>> Using uninitialized value "notify_evt" when calling "*hdev->notify".
4535 hdev->notify(hdev, notify_evt);
4536 }
4537
4538 hci_connect_cfm(conn, ev->status);
4539 if (ev->status)
4540 hci_conn_del(conn);
[...]
Although only btusb uses air_mode, and he only handles HCI_NOTIFY_ENABLE_SCO_CVSD
and HCI_NOTIFY_ENABLE_SCO_TRANSP, there is still a very small chance that
ev->air_mode is not equal to 0x2 and 0x3, but notify_evt is initialized to
HCI_NOTIFY_ENABLE_SCO_CVSD or HCI_NOTIFY_ENABLE_SCO_TRANSP. the context is
maybe not correct.
Let us directly use the required function instead of re-initializing it,
so as to restore the original logic and make the code more correct.
Addresses-Coverity: ("Uninitialized variables")
Fixes: f4f9fa0 ("Bluetooth: Allow usb to auto-suspend when SCO use non-HCI transport")
Suggested-by: Marcel Holtmann <[email protected]>
Signed-off-by: Jackie Liu <[email protected]>
Signed-off-by: Marcel Holtmann <[email protected]>1 parent 3a56ef7 commit a27c519
1 file changed
+9
-14
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4530 | 4530 | | |
4531 | 4531 | | |
4532 | 4532 | | |
4533 | | - | |
4534 | 4533 | | |
4535 | 4534 | | |
4536 | 4535 | | |
| |||
4602 | 4601 | | |
4603 | 4602 | | |
4604 | 4603 | | |
4605 | | - | |
4606 | | - | |
4607 | | - | |
4608 | | - | |
4609 | | - | |
4610 | | - | |
4611 | | - | |
4612 | | - | |
4613 | | - | |
4614 | | - | |
4615 | 4604 | | |
4616 | 4605 | | |
4617 | 4606 | | |
4618 | | - | |
4619 | | - | |
4620 | | - | |
| 4607 | + | |
| 4608 | + | |
| 4609 | + | |
| 4610 | + | |
| 4611 | + | |
| 4612 | + | |
| 4613 | + | |
| 4614 | + | |
| 4615 | + | |
4621 | 4616 | | |
4622 | 4617 | | |
4623 | 4618 | | |
| |||
0 commit comments