Linux-Bluetooth Archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] Bluetooth: mgmt: remove useless NULL checks
@ 2024-03-01 13:39 Roman Smirnov
  2024-03-01 13:39 ` [PATCH v2 1/2] Bluetooth: mgmt: remove NULL check in mgmt_set_connectable_complete() Roman Smirnov
                   ` (2 more replies)
  0 siblings, 3 replies; 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

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

The second version has a more compact subjects compared to the
first version.

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 [PATCH v2 0/2] Bluetooth: mgmt: remove useless NULL checks Roman Smirnov
@ 2024-03-01 13:39 ` Roman Smirnov
  2024-03-01 14:31   ` Bluetooth: mgmt: remove useless NULL checks bluez.test.bot
  2024-03-01 13:39 ` [PATCH v2 2/2] Bluetooth: mgmt: remove NULL check in add_ext_adv_params_complete() Roman Smirnov
  2024-03-04 21:30 ` [PATCH v2 0/2] Bluetooth: mgmt: remove useless NULL checks patchwork-bot+bluetooth
  2 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

* [PATCH v2 2/2] Bluetooth: mgmt: remove NULL check in add_ext_adv_params_complete()
  2024-03-01 13:39 [PATCH v2 0/2] Bluetooth: mgmt: remove useless NULL checks Roman Smirnov
  2024-03-01 13:39 ` [PATCH v2 1/2] Bluetooth: mgmt: remove NULL check in mgmt_set_connectable_complete() Roman Smirnov
@ 2024-03-01 13:39 ` Roman Smirnov
  2024-03-04 21:30 ` [PATCH v2 0/2] Bluetooth: mgmt: remove useless NULL checks patchwork-bot+bluetooth
  2 siblings, 0 replies; 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 add_ext_adv_params_complete()
because it occurs earlier in add_ext_adv_params(). 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 cd8c4e094c55..b48d2d974263 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -8826,8 +8826,7 @@ static void add_ext_adv_params_complete(struct hci_dev *hdev, void *data,
 	}
 
 unlock:
-	if (cmd)
-		mgmt_pending_free(cmd);
+	mgmt_pending_free(cmd);
 
 	hci_dev_unlock(hdev);
 }
-- 
2.34.1

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

* RE: Bluetooth: mgmt: remove useless NULL checks
  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   ` bluez.test.bot
  0 siblings, 0 replies; 5+ messages in thread
From: bluez.test.bot @ 2024-03-01 14:31 UTC (permalink / raw
  To: linux-bluetooth, r.smirnov

[-- Attachment #1: Type: text/plain, Size: 1420 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=831524

---Test result---

Test Summary:
CheckPatch                    PASS      1.24 seconds
GitLint                       PASS      0.62 seconds
SubjectPrefix                 PASS      0.24 seconds
BuildKernel                   PASS      27.82 seconds
CheckAllWarning               PASS      30.33 seconds
CheckSparse                   PASS      36.28 seconds
CheckSmatch                   PASS      97.76 seconds
BuildKernel32                 PASS      26.87 seconds
TestRunnerSetup               PASS      495.91 seconds
TestRunner_l2cap-tester       PASS      18.05 seconds
TestRunner_iso-tester         PASS      28.31 seconds
TestRunner_bnep-tester        PASS      4.78 seconds
TestRunner_mgmt-tester        PASS      111.03 seconds
TestRunner_rfcomm-tester      PASS      7.36 seconds
TestRunner_sco-tester         PASS      14.95 seconds
TestRunner_ioctl-tester       PASS      7.87 seconds
TestRunner_mesh-tester        PASS      5.91 seconds
TestRunner_smp-tester         PASS      6.84 seconds
TestRunner_userchan-tester    PASS      4.97 seconds
IncrementalBuild              PASS      32.08 seconds



---
Regards,
Linux Bluetooth


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

* Re: [PATCH v2 0/2] Bluetooth: mgmt: remove useless NULL checks
  2024-03-01 13:39 [PATCH v2 0/2] Bluetooth: mgmt: remove useless NULL checks Roman Smirnov
  2024-03-01 13:39 ` [PATCH v2 1/2] Bluetooth: mgmt: remove NULL check in mgmt_set_connectable_complete() Roman Smirnov
  2024-03-01 13:39 ` [PATCH v2 2/2] Bluetooth: mgmt: remove NULL check in add_ext_adv_params_complete() Roman Smirnov
@ 2024-03-04 21:30 ` patchwork-bot+bluetooth
  2 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+bluetooth @ 2024-03-04 21:30 UTC (permalink / raw
  To: Roman Smirnov
  Cc: marcel, johan.hedberg, luiz.dentz, s.shtylyov, linux-bluetooth,
	linux-kernel, lvc-project

Hello:

This series was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Fri, 1 Mar 2024 13:39:14 +0000 you wrote:
> Svace reports NULL check after dereference in
> mgmt_set_connectable_complete() and add_ext_adv_params_complete().
> The following patches remove these checks.
> 
> The second version has a more compact subjects compared to the
> first version.
> 
> [...]

Here is the summary with links:
  - [v2,1/2] Bluetooth: mgmt: remove NULL check in mgmt_set_connectable_complete()
    https://git.kernel.org/bluetooth/bluetooth-next/c/9f67e5ba6f6c
  - [v2,2/2] Bluetooth: mgmt: remove NULL check in add_ext_adv_params_complete()
    https://git.kernel.org/bluetooth/bluetooth-next/c/3da5589ad808

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] 5+ messages in thread

end of thread, other threads:[~2024-03-04 21:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-01 13:39 [PATCH v2 0/2] Bluetooth: mgmt: remove useless NULL checks Roman Smirnov
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
2024-03-01 13:39 ` [PATCH v2 2/2] Bluetooth: mgmt: remove NULL check in add_ext_adv_params_complete() Roman Smirnov
2024-03-04 21:30 ` [PATCH v2 0/2] Bluetooth: mgmt: remove useless NULL checks 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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).