* [PATCH BlueZ v1] btdev: Fix scan-build warnings
@ 2025-03-06 16:00 Luiz Augusto von Dentz
2025-03-06 17:14 ` [BlueZ,v1] " bluez.test.bot
2025-03-06 18:00 ` [PATCH BlueZ v1] " patchwork-bot+bluetooth
0 siblings, 2 replies; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2025-03-06 16:00 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This fixes the following scan-build warnings:
emulator/btdev.c:1126:10: warning: Although the value stored to 'conn' is used in the enclosing expression, the value is never actually read from 'conn' [deadcode.DeadStores]
1126 | while ((conn = queue_find(dev->conns, match_handle,
| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1127 | UINT_TO_PTR(handle))))
| ~~~~~~~~~~~~~~~~~~~~
emulator/btdev.c:1413:24: warning: Access to field 'link' results in a dereference of a null pointer (loaded from variable 'conn') [core.NullDereference]
1413 | pending_conn_del(dev, conn->link->dev);
| ^~~~~~~~~~
emulator/btdev.c:1535:13: warning: Access to field 'dev' results in a dereference of a null pointer (loaded from variable 'conn') [core.NullDereference]
1535 | send_event(conn->dev, BT_HCI_EVT_AUTH_COMPLETE, &ev, sizeof(ev));
| ^~~~~~~~~
---
emulator/btdev.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/emulator/btdev.c b/emulator/btdev.c
index ec52c5242df0..77d44ad84548 100644
--- a/emulator/btdev.c
+++ b/emulator/btdev.c
@@ -1123,8 +1123,7 @@ static struct btdev_conn *conn_new(struct btdev *dev, uint16_t handle,
{
struct btdev_conn *conn;
- while ((conn = queue_find(dev->conns, match_handle,
- UINT_TO_PTR(handle))))
+ while (queue_find(dev->conns, match_handle, UINT_TO_PTR(handle)))
handle++;
conn = new0(struct btdev_conn, 1);
@@ -1410,8 +1409,6 @@ static int cmd_add_sco_conn(struct btdev *dev, const void *data, uint8_t len)
cc.encr_mode = 0x00;
done:
- pending_conn_del(dev, conn->link->dev);
-
send_event(dev, BT_HCI_EVT_CONN_COMPLETE, &cc, sizeof(cc));
return 0;
@@ -1527,9 +1524,12 @@ static void auth_complete(struct btdev_conn *conn, uint8_t status)
{
struct bt_hci_evt_auth_complete ev;
+ if (!conn)
+ return;
+
memset(&ev, 0, sizeof(ev));
- ev.handle = conn ? cpu_to_le16(conn->handle) : 0x0000;
+ ev.handle = cpu_to_le16(conn->handle);
ev.status = status;
send_event(conn->dev, BT_HCI_EVT_AUTH_COMPLETE, &ev, sizeof(ev));
--
2.48.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* RE: [BlueZ,v1] btdev: Fix scan-build warnings
2025-03-06 16:00 [PATCH BlueZ v1] btdev: Fix scan-build warnings Luiz Augusto von Dentz
@ 2025-03-06 17:14 ` bluez.test.bot
2025-03-06 18:00 ` [PATCH BlueZ v1] " patchwork-bot+bluetooth
1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2025-03-06 17:14 UTC (permalink / raw)
To: linux-bluetooth, luiz.dentz
[-- Attachment #1: Type: text/plain, Size: 1426 bytes --]
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=941078
---Test result---
Test Summary:
CheckPatch PENDING 0.21 seconds
GitLint PENDING 0.21 seconds
BuildEll PASS 20.77 seconds
BluezMake PASS 1518.85 seconds
MakeCheck PASS 13.48 seconds
MakeDistcheck PASS 157.01 seconds
CheckValgrind PASS 212.28 seconds
CheckSmatch WARNING 281.44 seconds
bluezmakeextell PASS 97.61 seconds
IncrementalBuild PENDING 0.29 seconds
ScanBuild PASS 852.14 seconds
Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:
##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:
##############################
Test: CheckSmatch - WARNING
Desc: Run smatch tool with source
Output:
emulator/btdev.c:450:29: warning: Variable length array is used.
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH BlueZ v1] btdev: Fix scan-build warnings
2025-03-06 16:00 [PATCH BlueZ v1] btdev: Fix scan-build warnings Luiz Augusto von Dentz
2025-03-06 17:14 ` [BlueZ,v1] " bluez.test.bot
@ 2025-03-06 18:00 ` patchwork-bot+bluetooth
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+bluetooth @ 2025-03-06 18:00 UTC (permalink / raw)
To: Luiz Augusto von Dentz; +Cc: linux-bluetooth
Hello:
This patch was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:
On Thu, 6 Mar 2025 11:00:03 -0500 you wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
>
> This fixes the following scan-build warnings:
>
> emulator/btdev.c:1126:10: warning: Although the value stored to 'conn' is used in the enclosing expression, the value is never actually read from 'conn' [deadcode.DeadStores]
> 1126 | while ((conn = queue_find(dev->conns, match_handle,
> | ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 1127 | UINT_TO_PTR(handle))))
> | ~~~~~~~~~~~~~~~~~~~~
> emulator/btdev.c:1413:24: warning: Access to field 'link' results in a dereference of a null pointer (loaded from variable 'conn') [core.NullDereference]
> 1413 | pending_conn_del(dev, conn->link->dev);
> | ^~~~~~~~~~
> emulator/btdev.c:1535:13: warning: Access to field 'dev' results in a dereference of a null pointer (loaded from variable 'conn') [core.NullDereference]
> 1535 | send_event(conn->dev, BT_HCI_EVT_AUTH_COMPLETE, &ev, sizeof(ev));
> | ^~~~~~~~~
>
> [...]
Here is the summary with links:
- [BlueZ,v1] btdev: Fix scan-build warnings
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=04cd5d2a97c8
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-03-06 18:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-06 16:00 [PATCH BlueZ v1] btdev: Fix scan-build warnings Luiz Augusto von Dentz
2025-03-06 17:14 ` [BlueZ,v1] " bluez.test.bot
2025-03-06 18:00 ` [PATCH BlueZ v1] " patchwork-bot+bluetooth
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox