diff mbox series

[BlueZ,v1] shared/vcp: Fix comparison of values in different endianess

Message ID 20231204220711.2974630-1-luiz.dentz@gmail.com (mailing list archive)
State Accepted
Commit eae77d7e49cec29ab06e1c132d9750cdef3d01b5
Headers show
Series [BlueZ,v1] shared/vcp: Fix comparison of values in different endianess | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/CheckPatch warning WARNING:TYPO_SPELLING: 'endianess' may be misspelled - perhaps 'endianness'? #72: need to be converted to host endianess before comparing with other ^^^^^^^^^ /github/workspace/src/src/13479146.patch total: 0 errors, 1 warnings, 20 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/13479146.patch has style problems, please review. NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO NOTE: If any of the errors are false positives, please report them to the maintainer, see CHECKPATCH in MAINTAINERS.
tedd_an/GitLint success Gitlint PASS
tedd_an/BuildEll success Build ELL PASS
tedd_an/BluezMake success Bluez Make PASS
tedd_an/MakeCheck success Bluez Make Check PASS
tedd_an/MakeDistcheck success Make Distcheck PASS
tedd_an/CheckValgrind success Check Valgrind PASS
tedd_an/CheckSmatch success CheckSparse PASS
tedd_an/bluezmakeextell success Make External ELL PASS
tedd_an/IncrementalBuild success Incremental Build PASS
tedd_an/ScanBuild success Scan Build PASS

Commit Message

Luiz Augusto von Dentz Dec. 4, 2023, 10:07 p.m. UTC
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

Values received over the air are in Little Endian format so they first
need to be converted to host endianess before comparing with other
values.
---
 src/shared/vcp.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

Comments

bluez.test.bot@gmail.com Dec. 4, 2023, 11:23 p.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=806818

---Test result---

Test Summary:
CheckPatch                    FAIL      0.72 seconds
GitLint                       PASS      0.34 seconds
BuildEll                      PASS      24.02 seconds
BluezMake                     PASS      550.97 seconds
MakeCheck                     PASS      10.61 seconds
MakeDistcheck                 PASS      150.28 seconds
CheckValgrind                 PASS      214.53 seconds
CheckSmatch                   PASS      316.92 seconds
bluezmakeextell               PASS      96.83 seconds
IncrementalBuild              PASS      502.93 seconds
ScanBuild                     PASS      920.45 seconds

Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script
Output:
[BlueZ,v1] shared/vcp: Fix comparison of values in different endianess
WARNING:TYPO_SPELLING: 'endianess' may be misspelled - perhaps 'endianness'?
#72: 
need to be converted to host endianess before comparing with other
                             ^^^^^^^^^

/github/workspace/src/src/13479146.patch total: 0 errors, 1 warnings, 20 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/13479146.patch has style problems, please review.

NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO

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




---
Regards,
Linux Bluetooth
patchwork-bot+bluetooth@kernel.org Dec. 5, 2023, 3:40 a.m. UTC | #2
Hello:

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

On Mon,  4 Dec 2023 17:07:11 -0500 you wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> 
> Values received over the air are in Little Endian format so they first
> need to be converted to host endianess before comparing with other
> values.
> ---
>  src/shared/vcp.c | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)

Here is the summary with links:
  - [BlueZ,v1] shared/vcp: Fix comparison of values in different endianess
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=eae77d7e49ce

You are awesome, thank you!
diff mbox series

Patch

diff --git a/src/shared/vcp.c b/src/shared/vcp.c
index 06a22997a95c..5d163266b480 100644
--- a/src/shared/vcp.c
+++ b/src/shared/vcp.c
@@ -709,13 +709,16 @@  static uint8_t vocs_set_vol_offset(struct bt_vocs *vocs, struct bt_vcp *vcp,
 		return BT_ATT_ERROR_INVALID_CHANGE_COUNTER;
 	}
 
-	if (req->set_vol_offset > VOCS_VOL_OFFSET_UPPER_LIMIT ||
-		req->set_vol_offset < VOCS_VOL_OFFSET_LOWER_LIMIT) {
+	vstate->vol_offset = le16_to_cpu(req->set_vol_offset);
+
+	if (vstate->vol_offset > VOCS_VOL_OFFSET_UPPER_LIMIT ||
+		vstate->vol_offset < VOCS_VOL_OFFSET_LOWER_LIMIT) {
 		DBG(vcp, "error: Value Out of Range");
 		return BT_ATT_ERROR_VALUE_OUT_OF_RANGE;
 	}
-	vstate->vol_offset = le16_to_cpu(req->set_vol_offset);
-	vstate->counter = -~vstate->counter; /*Increment Change Counter*/
+
+	/* Increment Change Counter */
+	vstate->counter = -~vstate->counter;
 
 	gatt_db_attribute_notify(vdb->vocs->vos, (void *)vstate,
 				 sizeof(struct vol_offset_state),