Bluetooth: Fix unused value warning in sco_sock_connect
Subsystems (2)
PATCH 1/1 Bluetooth: Fix unused value warning in sco_sock_connect
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.
--- net/bluetooth/sco.c | 3 --- 1 file changed, 3 deletions(-)
net/bluetooth/sco.c +0 -3
@@ -581,9 +581,6 @@ static int sco_sock_connect(struct socket *sock, struct sockaddr *addr, int alenif (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);
Signature · 1 line
2.34.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 <[email protected]>' != 'Signed-off-by: Bharath SM <[email protected]>'
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
Hi,
la, 2024-03-23 kello 12:52 +0530, Bharath SM kirjoitti:
Quoted 19 lines
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 <[email protected]>--- net/bluetooth/sco.c | 3 --- 1 file changed, 3 deletions(-)net/bluetooth/sco.c +0
-0
net/bluetooth/sco.c static int sco_sock_connect(struct socket *sock, struct sockaddr *addr, int alen · line 586
Quoted 6 lines
net/bluetooth/sco.c +0
-3@@ -581,9 +581,6 @@ static int sco_sock_connect(struct socket *sock, struct sockaddr *addr, int alenif (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.
Quoted 3 lines
net/bluetooth/sco.c +0
-0lock_sock (sk);/* Set destination address and psm */ bacpy (&sco_pi (sk)->dst, &sa->sco_bdaddr);
Signature · 1 line
Pauli Virtanen