linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Bluetooth: mgmt: remove useless NULL checks
@ 2024-03-01  7:48 Roman Smirnov
  2024-03-01  7:48 ` [PATCH 1/2] Bluetooth: mgmt: remove useless NULL check in mgmt_set_connectable_complete() Roman Smirnov
  2024-03-01  7:48 ` [PATCH 2/2] Bluetooth: mgmt: remove useless NULL check in add_ext_adv_params_complete() Roman Smirnov
  0 siblings, 2 replies; 5+ messages in thread
From: Roman Smirnov @ 2024-03-01  7:48 UTC (permalink / raw)
  To: Marcel Holtmann
  Cc: Roman Smirnov, Johan Hedberg, Luiz Augusto von Dentz,
	Sergey Shtylyov, linux-bluetooth, linux-kernel, lvc-project

Svace reports NULL check after dereference in
mgmt_set_connectable_complete() and add_ext_adv_params_complete().
The following patches remove these checks.

Found by Linux Verification Center (linuxtesting.org) with Svace.

Roman Smirnov (2):
  Bluetooth: mgmt: remove useless NULL checks in
    mgmt_set_connectable_complete()
  Bluetooth: mgmt: remove useless NULL checks in
    add_ext_adv_params_complete()

 net/bluetooth/mgmt.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

-- 
2.34.1

^ permalink raw reply	[flat|nested] 5+ messages in thread
* [PATCH v2 1/2] Bluetooth: mgmt: remove NULL check in mgmt_set_connectable_complete()
@ 2024-03-01 13:39 Roman Smirnov
  2024-03-01 14:31 ` Bluetooth: mgmt: remove useless NULL checks bluez.test.bot
  0 siblings, 1 reply; 5+ messages in thread
From: Roman Smirnov @ 2024-03-01 13:39 UTC (permalink / raw)
  To: Marcel Holtmann
  Cc: Roman Smirnov, Johan Hedberg, Luiz Augusto von Dentz,
	Sergey Shtylyov, linux-bluetooth, linux-kernel, lvc-project

Remove the cmd pointer NULL check in mgmt_set_connectable_complete()
because it occurs earlier in set_connectable(). This check is also
unnecessary because the pointer is dereferenced just before it.

Found by Linux Verification Center (linuxtesting.org) with Svace.

Signed-off-by: Roman Smirnov <r.smirnov@omp.ru>
Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru>
---
 net/bluetooth/mgmt.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index bb72ff6eb22f..cd8c4e094c55 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -1702,8 +1702,7 @@ static void mgmt_set_connectable_complete(struct hci_dev *hdev, void *data,
 	new_settings(hdev, cmd->sk);
 
 done:
-	if (cmd)
-		mgmt_pending_remove(cmd);
+	mgmt_pending_remove(cmd);
 
 	hci_dev_unlock(hdev);
 }
-- 
2.34.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-03-01 14:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-01  7:48 [PATCH 0/2] Bluetooth: mgmt: remove useless NULL checks Roman Smirnov
2024-03-01  7:48 ` [PATCH 1/2] Bluetooth: mgmt: remove useless NULL check in mgmt_set_connectable_complete() Roman Smirnov
2024-03-01  8:35   ` Bluetooth: mgmt: remove useless NULL checks bluez.test.bot
2024-03-01  7:48 ` [PATCH 2/2] Bluetooth: mgmt: remove useless NULL check in add_ext_adv_params_complete() Roman Smirnov
  -- strict thread matches above, loose matches on Subject: below --
2024-03-01 13:39 [PATCH v2 1/2] Bluetooth: mgmt: remove NULL check in mgmt_set_connectable_complete() Roman Smirnov
2024-03-01 14:31 ` Bluetooth: mgmt: remove useless NULL checks bluez.test.bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).