diff mbox series

Bluetooth: Fix unused value warning in sco_sock_connect

Message ID 20240323072253.40816-1-bharathsm@microsoft.com (mailing list archive)
State New, archived
Headers show
Series Bluetooth: Fix unused value warning in sco_sock_connect | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/CheckPatch warning 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.
tedd_an/GitLint fail 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;"
tedd_an/SubjectPrefix success Gitlint PASS
tedd_an/BuildKernel success BuildKernel PASS
tedd_an/CheckAllWarning success CheckAllWarning PASS
tedd_an/CheckSparse warning CheckSparse WARNING net/bluetooth/sco.c: note: in included file:./include/net/bluetooth/hci_core.h:150:35: warning: array of flexible structures
tedd_an/CheckSmatch warning CheckSparse WARNING net/bluetooth/sco.c: note: in included file:./include/net/bluetooth/hci_core.h:150:35: warning: array of flexible structures
tedd_an/BuildKernel32 success BuildKernel32 PASS
tedd_an/TestRunnerSetup success TestRunnerSetup PASS
tedd_an/TestRunner_l2cap-tester success TestRunner PASS
tedd_an/TestRunner_iso-tester fail TestRunner_iso-tester: Total: 117, Passed: 116 (99.1%), Failed: 1, Not Run: 0
tedd_an/TestRunner_bnep-tester success TestRunner PASS
tedd_an/TestRunner_mgmt-tester success TestRunner PASS
tedd_an/TestRunner_rfcomm-tester success TestRunner PASS
tedd_an/TestRunner_sco-tester success TestRunner PASS
tedd_an/TestRunner_ioctl-tester success TestRunner PASS
tedd_an/TestRunner_mesh-tester success TestRunner PASS
tedd_an/TestRunner_smp-tester success TestRunner PASS
tedd_an/TestRunner_userchan-tester success TestRunner PASS
tedd_an/IncrementalBuild success Incremental Build PASS

Commit Message

Bharath SM March 23, 2024, 7:22 a.m. UTC
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(-)

Comments

bluez.test.bot@gmail.com March 23, 2024, 7:57 a.m. UTC | #1
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
Pauli Virtanen March 23, 2024, 9:51 a.m. UTC | #2
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);
diff mbox series

Patch

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);