Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: Fix unused value warning in sco_sock_connect
@ 2024-03-23  7:22 Bharath SM
  2024-03-23  7:57 ` bluez.test.bot
  2024-03-23  9:51 ` [PATCH] " Pauli Virtanen
  0 siblings, 2 replies; 3+ messages in thread
From: Bharath SM @ 2024-03-23  7:22 UTC (permalink / raw)
  To: marcel, johan.hedberg, luiz.von.dentz, linux-bluetooth; +Cc: Bharath SM

Coverity complains of an unused value:

CID 1528147: (#1 of 1): Unused value (UNUSED_VALUE)
assigned_value: Assigning value -22 to err here, but that stored
value is overwritten before it can be used.
	err = -EINVAL;

Fix it by removing the assignment.

Signed-off-by: Bharath SM <bharathsm@microsoft.com>
---
 net/bluetooth/sco.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c
index 43daf965a01e..e74bce4e1d6c 100644
--- a/net/bluetooth/sco.c
+++ b/net/bluetooth/sco.c
@@ -581,9 +581,6 @@ static int sco_sock_connect(struct socket *sock, struct sockaddr *addr, int alen
 	if (sk->sk_state != BT_OPEN && sk->sk_state != BT_BOUND)
 		return -EBADFD;
 
-	if (sk->sk_type != SOCK_SEQPACKET)
-		err = -EINVAL;
-
 	lock_sock(sk);
 	/* Set destination address and psm */
 	bacpy(&sco_pi(sk)->dst, &sa->sco_bdaddr);
-- 
2.34.1


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

* RE: Bluetooth: Fix unused value warning in sco_sock_connect
  2024-03-23  7:22 [PATCH] Bluetooth: Fix unused value warning in sco_sock_connect Bharath SM
@ 2024-03-23  7:57 ` bluez.test.bot
  2024-03-23  9:51 ` [PATCH] " Pauli Virtanen
  1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2024-03-23  7:57 UTC (permalink / raw)
  To: linux-bluetooth, bharathsm.hsk

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

---Test result---

Test Summary:
CheckPatch                    FAIL      0.86 seconds
GitLint                       FAIL      5.92 seconds
SubjectPrefix                 PASS      0.12 seconds
BuildKernel                   PASS      27.45 seconds
CheckAllWarning               PASS      30.47 seconds
CheckSparse                   WARNING   35.92 seconds
CheckSmatch                   WARNING   98.49 seconds
BuildKernel32                 PASS      26.98 seconds
TestRunnerSetup               PASS      507.22 seconds
TestRunner_l2cap-tester       PASS      19.19 seconds
TestRunner_iso-tester         FAIL      34.61 seconds
TestRunner_bnep-tester        PASS      4.80 seconds
TestRunner_mgmt-tester        PASS      115.96 seconds
TestRunner_rfcomm-tester      PASS      7.45 seconds
TestRunner_sco-tester         PASS      14.92 seconds
TestRunner_ioctl-tester       PASS      7.76 seconds
TestRunner_mesh-tester        PASS      5.92 seconds
TestRunner_smp-tester         PASS      6.84 seconds
TestRunner_userchan-tester    PASS      5.02 seconds
IncrementalBuild              PASS      25.84 seconds

Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script
Output:
Bluetooth: Fix unused value warning in sco_sock_connect
WARNING: From:/Signed-off-by: email address mismatch: 'From: Bharath SM <bharathsm.hsk@gmail.com>' != 'Signed-off-by: Bharath SM <bharathsm@microsoft.com>'

total: 0 errors, 1 warnings, 0 checks, 9 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
      mechanically convert to the typical style using --fix or --fix-inplace.

/github/workspace/src/src/13600542.patch has style problems, please review.

NOTE: Ignored message types: UNKNOWN_COMMIT_ID

NOTE: If any of the errors are false positives, please report
      them to the maintainer, see CHECKPATCH in MAINTAINERS.


##############################
Test: GitLint - FAIL
Desc: Run gitlint
Output:
Bluetooth: Fix unused value warning in sco_sock_connect

WARNING: I3 - ignore-body-lines: gitlint will be switching from using Python regex 'match' (match beginning) to 'search' (match anywhere) semantics. Please review your ignore-body-lines.regex option accordingly. To remove this warning, set general.regex-style-search=True. More details: https://jorisroovers.github.io/gitlint/configuration/#regex-style-search
8: B3 Line contains hard tab characters (\t): "	err = -EINVAL;"
##############################
Test: CheckSparse - WARNING
Desc: Run sparse tool with linux kernel
Output:
net/bluetooth/sco.c: note: in included file:./include/net/bluetooth/hci_core.h:150:35: warning: array of flexible structures
##############################
Test: CheckSmatch - WARNING
Desc: Run smatch tool with source
Output:
net/bluetooth/sco.c: note: in included file:./include/net/bluetooth/hci_core.h:150:35: warning: array of flexible structures
##############################
Test: TestRunner_iso-tester - FAIL
Desc: Run iso-tester with test-runner
Output:
Total: 117, Passed: 116 (99.1%), Failed: 1, Not Run: 0

Failed Test Cases
ISO Connect2 Suspend - Success                       Failed       6.228 seconds


---
Regards,
Linux Bluetooth


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

* Re: [PATCH] Bluetooth: Fix unused value warning in sco_sock_connect
  2024-03-23  7:22 [PATCH] Bluetooth: Fix unused value warning in sco_sock_connect Bharath SM
  2024-03-23  7:57 ` bluez.test.bot
@ 2024-03-23  9:51 ` Pauli Virtanen
  1 sibling, 0 replies; 3+ messages in thread
From: Pauli Virtanen @ 2024-03-23  9:51 UTC (permalink / raw)
  To: Bharath SM; +Cc: linux-bluetooth, Bharath SM

Hi,

la, 2024-03-23 kello 12:52 +0530, Bharath SM kirjoitti:
> Coverity complains of an unused value:
> 
> CID 1528147: (#1 of 1): Unused value (UNUSED_VALUE)
> assigned_value: Assigning value -22 to err here, but that stored
> value is overwritten before it can be used.
> 	err = -EINVAL;
> 
> Fix it by removing the assignment.
> 
> Signed-off-by: Bharath SM <bharathsm@microsoft.com>
> ---
>  net/bluetooth/sco.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c
> index 43daf965a01e..e74bce4e1d6c 100644
> --- a/net/bluetooth/sco.c
> +++ b/net/bluetooth/sco.c
> @@ -581,9 +581,6 @@ static int sco_sock_connect(struct socket *sock, struct sockaddr *addr, int alen
>  	if (sk->sk_state != BT_OPEN && sk->sk_state != BT_BOUND)
>  		return -EBADFD;
>  
> -	if (sk->sk_type != SOCK_SEQPACKET)
> -		err = -EINVAL;
> -

It should return -EINVAL here, not remove the check.

Looks like it got broken in 9a8ec9e8ebb5a7c0cfbce2d6b4a6b67b2b78e8f3 in
the locking refactoring.

>  	lock_sock(sk);
>  	/* Set destination address and psm */
>  	bacpy(&sco_pi(sk)->dst, &sa->sco_bdaddr);

-- 
Pauli Virtanen

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

end of thread, other threads:[~2024-03-23  9:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-23  7:22 [PATCH] Bluetooth: Fix unused value warning in sco_sock_connect Bharath SM
2024-03-23  7:57 ` bluez.test.bot
2024-03-23  9:51 ` [PATCH] " Pauli Virtanen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox