diff mbox series

[BlueZ,1/2] uuid-helper: Accept any 16-bit HEX value as a valid UUID

Message ID 20250302090331.17756-1-arkadiusz.bokowy@gmail.com (mailing list archive)
State New
Headers show
Series [BlueZ,1/2] uuid-helper: Accept any 16-bit HEX value as a valid UUID | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/BuildEll success Build ELL PASS
tedd_an/BluezMake fail BluezMake FAIL: src/uuid-helper.c: In function ‘bt_name2string’: src/uuid-helper.c:174:6: error: unused variable ‘i’ [-Werror=unused-variable] 174 | int i; | ^ cc1: all warnings being treated as errors make[1]: *** [Makefile:7851: src/uuid-helper.o] Error 1 make[1]: *** Waiting for unfinished jobs.... tools/mgmt-tester.c: In function ‘main’: tools/mgmt-tester.c:12893:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without 12893 | int main(int argc, char *argv[]) | ^~~~ make: *** [Makefile:4682: all] Error 2
tedd_an/MakeCheck fail BlueZ Make Check FAIL:
tedd_an/MakeDistcheck success Make Distcheck PASS
tedd_an/CheckValgrind fail Check Valgrind FAIL: src/uuid-helper.c: In function ‘bt_name2string’: src/uuid-helper.c:174:6: error: unused variable ‘i’ [-Werror=unused-variable] 174 | int i; | ^ cc1: all warnings being treated as errors make[1]: *** [Makefile:7851: src/uuid-helper.o] Error 1 make[1]: *** Waiting for unfinished jobs.... tools/mgmt-tester.c: In function ‘main’: tools/mgmt-tester.c:12893:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without 12893 | int main(int argc, char *argv[]) | ^~~~ make: *** [Makefile:12320: check] Error 2
tedd_an/CheckSmatch fail CheckSparse: FAIL: src/shared/crypto.c:271:21: warning: Variable length array is used. src/shared/crypto.c:272:23: warning: Variable length array is used. src/shared/gatt-helpers.c:768:31: warning: Variable length array is used. src/shared/gatt-helpers.c:830:31: warning: Variable length array is used. src/shared/gatt-helpers.c:1323:31: warning: Variable length array is used. src/shared/gatt-helpers.c:1354:23: warning: Variable length array is used. src/shared/gatt-server.c:278:25: warning: Variable length array is used. src/shared/gatt-server.c:618:25: warning: Variable length array is used. src/shared/gatt-server.c:716:25: warning: Variable length array is used. src/shared/bap.c:305:25: warning: array of flexible structures src/shared/bap.c: note: in included file: ./src/shared/ascs.h:88:25: warning: array of flexible structures src/shared/shell.c: note: in included file (through /usr/include/readline/readline.h): /usr/include/readline/rltypedefs.h:35:23: warning: non-ANSI function declaration of function 'Function' /usr/include/readline/rltypedefs.h:36:25: warning: non-ANSI function declaration of function 'VFunction' /usr/include/readline/rltypedefs.h:37:27: warning: non-ANSI function declaration of function 'CPFunction' /usr/include/readline/rltypedefs.h:38:29: warning: non-ANSI function declaration of function 'CPPFunction' src/shared/crypto.c:271:21: warning: Variable length array is used. src/shared/crypto.c:272:23: warning: Variable length array is used. src/shared/gatt-helpers.c:768:31: warning: Variable length array is used. src/shared/gatt-helpers.c:830:31: warning: Variable length array is used. src/shared/gatt-helpers.c:1323:31: warning: Variable length array is used. src/shared/gatt-helpers.c:1354:23: warning: Variable length array is used. src/shared/gatt-server.c:278:25: warning: Variable length array is used. src/shared/gatt-server.c:618:25: warning: Variable length array is used. src/shared/gatt-server.c:716:25: warning: Variable length array is used. src/shared/bap.c:305:25: warning: array of flexible structures src/shared/bap.c: note: in included file: ./src/shared/ascs.h:88:25: warning: array of flexible structures src/shared/shell.c: note: in included file (through /usr/include/readline/readline.h): /usr/include/readline/rltypedefs.h:35:23: warning: non-ANSI function declaration of function 'Function' /usr/include/readline/rltypedefs.h:36:25: warning: non-ANSI function declaration of function 'VFunction' /usr/include/readline/rltypedefs.h:37:27: warning: non-ANSI function declaration of function 'CPFunction' /usr/include/readline/rltypedefs.h:38:29: warning: non-ANSI function declaration of function 'CPPFunction' tools/mesh-cfgtest.c:1453:17: warning: unknown escape sequence: '\%' tools/sco-tester.c: note: in included file: ./lib/bluetooth.h:232:15: warning: array of flexible structures ./lib/bluetooth.h:237:31: warning: array of flexible structures tools/bneptest.c:634:39: warning: unknown escape sequence: '\%' tools/seq2bseq.c:57:26: warning: Variable length array is used. src/uuid-helper.c: In function ‘bt_name2string’: src/uuid-helper.c:174:6: error: unused variable ‘i’ [-Werror=unused-variable] 174 | int i; | ^ cc1: all warnings being treated as errors make[1]: *** [Makefile:7851: src/uuid-helper.o] Error 1 make[1]: *** Waiting for unfinished jobs.... make: *** [Makefile:4682: all] Error 2
tedd_an/bluezmakeextell fail Make External ELL FAIL: src/uuid-helper.c: In function ‘bt_name2string’: src/uuid-helper.c:174:6: error: unused variable ‘i’ [-Werror=unused-variable] 174 | int i; | ^ cc1: all warnings being treated as errors make[1]: *** [Makefile:7851: src/uuid-helper.o] Error 1 make[1]: *** Waiting for unfinished jobs.... make: *** [Makefile:4682: all] Error 2
tedd_an/ScanBuild success Scan Build PASS

Commit Message

Arkadiusz Bokowy March 2, 2025, 9:03 a.m. UTC
The bt_name2string() function restricts HEX values to the list of
predefined service names. This list is very limited, so loosing that
restriction will allow to pass any 16-bit HEX value as a profile to
D-Bus API calls like ConnectProfile or RegisterProfile.
---
 src/uuid-helper.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

Comments

bluez.test.bot@gmail.com March 2, 2025, 9:41 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=939333

---Test result---

Test Summary:
CheckPatch                    PENDING   0.18 seconds
GitLint                       PENDING   0.23 seconds
BuildEll                      PASS      20.74 seconds
BluezMake                     FAIL      49.22 seconds
MakeCheck                     FAIL      161.90 seconds
MakeDistcheck                 PASS      161.68 seconds
CheckValgrind                 FAIL      41.66 seconds
CheckSmatch                   FAIL      96.07 seconds
bluezmakeextell               FAIL      23.41 seconds
IncrementalBuild              PENDING   0.24 seconds
ScanBuild                     PASS      890.74 seconds

Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:

##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:

##############################
Test: BluezMake - FAIL
Desc: Build BlueZ
Output:

src/uuid-helper.c: In function ‘bt_name2string’:
src/uuid-helper.c:174:6: error: unused variable ‘i’ [-Werror=unused-variable]
  174 |  int i;
      |      ^
cc1: all warnings being treated as errors
make[1]: *** [Makefile:7851: src/uuid-helper.o] Error 1
make[1]: *** Waiting for unfinished jobs....
tools/mgmt-tester.c: In function ‘main’:
tools/mgmt-tester.c:12893:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without
12893 | int main(int argc, char *argv[])
      |     ^~~~
make: *** [Makefile:4682: all] Error 2
##############################
Test: MakeCheck - FAIL
Desc: Run Bluez Make Check
Output:

src/uuid-helper.c: In function ‘bt_name2string’:
src/uuid-helper.c:174:6: error: unused variable ‘i’ [-Werror=unused-variable]
  174 |  int i;
      |      ^
cc1: all warnings being treated as errors
make[1]: *** [Makefile:7851: src/uuid-helper.o] Error 1
make: *** [Makefile:12320: check] Error 2
##############################
Test: CheckValgrind - FAIL
Desc: Run Bluez Make Check with Valgrind
Output:

src/uuid-helper.c: In function ‘bt_name2string’:
src/uuid-helper.c:174:6: error: unused variable ‘i’ [-Werror=unused-variable]
  174 |  int i;
      |      ^
cc1: all warnings being treated as errors
make[1]: *** [Makefile:7851: src/uuid-helper.o] Error 1
make[1]: *** Waiting for unfinished jobs....
tools/mgmt-tester.c: In function ‘main’:
tools/mgmt-tester.c:12893:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without
12893 | int main(int argc, char *argv[])
      |     ^~~~
make: *** [Makefile:12320: check] Error 2
##############################
Test: CheckSmatch - FAIL
Desc: Run smatch tool with source
Output:

src/shared/crypto.c:271:21: warning: Variable length array is used.
src/shared/crypto.c:272:23: warning: Variable length array is used.
src/shared/gatt-helpers.c:768:31: warning: Variable length array is used.
src/shared/gatt-helpers.c:830:31: warning: Variable length array is used.
src/shared/gatt-helpers.c:1323:31: warning: Variable length array is used.
src/shared/gatt-helpers.c:1354:23: warning: Variable length array is used.
src/shared/gatt-server.c:278:25: warning: Variable length array is used.
src/shared/gatt-server.c:618:25: warning: Variable length array is used.
src/shared/gatt-server.c:716:25: warning: Variable length array is used.
src/shared/bap.c:305:25: warning: array of flexible structures
src/shared/bap.c: note: in included file:
./src/shared/ascs.h:88:25: warning: array of flexible structures
src/shared/shell.c: note: in included file (through /usr/include/readline/readline.h):
/usr/include/readline/rltypedefs.h:35:23: warning: non-ANSI function declaration of function 'Function'
/usr/include/readline/rltypedefs.h:36:25: warning: non-ANSI function declaration of function 'VFunction'
/usr/include/readline/rltypedefs.h:37:27: warning: non-ANSI function declaration of function 'CPFunction'
/usr/include/readline/rltypedefs.h:38:29: warning: non-ANSI function declaration of function 'CPPFunction'
src/shared/crypto.c:271:21: warning: Variable length array is used.
src/shared/crypto.c:272:23: warning: Variable length array is used.
src/shared/gatt-helpers.c:768:31: warning: Variable length array is used.
src/shared/gatt-helpers.c:830:31: warning: Variable length array is used.
src/shared/gatt-helpers.c:1323:31: warning: Variable length array is used.
src/shared/gatt-helpers.c:1354:23: warning: Variable length array is used.
src/shared/gatt-server.c:278:25: warning: Variable length array is used.
src/shared/gatt-server.c:618:25: warning: Variable length array is used.
src/shared/gatt-server.c:716:25: warning: Variable length array is used.
src/shared/bap.c:305:25: warning: array of flexible structures
src/shared/bap.c: note: in included file:
./src/shared/ascs.h:88:25: warning: array of flexible structures
src/shared/shell.c: note: in included file (through /usr/include/readline/readline.h):
/usr/include/readline/rltypedefs.h:35:23: warning: non-ANSI function declaration of function 'Function'
/usr/include/readline/rltypedefs.h:36:25: warning: non-ANSI function declaration of function 'VFunction'
/usr/include/readline/rltypedefs.h:37:27: warning: non-ANSI function declaration of function 'CPFunction'
/usr/include/readline/rltypedefs.h:38:29: warning: non-ANSI function declaration of function 'CPPFunction'
tools/mesh-cfgtest.c:1453:17: warning: unknown escape sequence: '\%'
tools/sco-tester.c: note: in included file:
./lib/bluetooth.h:232:15: warning: array of flexible structures
./lib/bluetooth.h:237:31: warning: array of flexible structures
tools/bneptest.c:634:39: warning: unknown escape sequence: '\%'
tools/seq2bseq.c:57:26: warning: Variable length array is used.
src/uuid-helper.c: In function ‘bt_name2string’:
src/uuid-helper.c:174:6: error: unused variable ‘i’ [-Werror=unused-variable]
  174 |  int i;
      |      ^
cc1: all warnings being treated as errors
make[1]: *** [Makefile:7851: src/uuid-helper.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:4682: all] Error 2
##############################
Test: bluezmakeextell - FAIL
Desc: Build Bluez with External ELL
Output:

src/uuid-helper.c: In function ‘bt_name2string’:
src/uuid-helper.c:174:6: error: unused variable ‘i’ [-Werror=unused-variable]
  174 |  int i;
      |      ^
cc1: all warnings being treated as errors
make[1]: *** [Makefile:7851: src/uuid-helper.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:4682: all] Error 2
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:



---
Regards,
Linux Bluetooth
patchwork-bot+bluetooth@kernel.org March 3, 2025, 5:50 p.m. UTC | #2
Hello:

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

On Sun,  2 Mar 2025 10:03:30 +0100 you wrote:
> The bt_name2string() function restricts HEX values to the list of
> predefined service names. This list is very limited, so loosing that
> restriction will allow to pass any 16-bit HEX value as a profile to
> D-Bus API calls like ConnectProfile or RegisterProfile.
> ---
>  src/uuid-helper.c | 11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)

Here is the summary with links:
  - [BlueZ,1/2] uuid-helper: Accept any 16-bit HEX value as a valid UUID
    (no matching commit)
  - [BlueZ,2/2] core: Report error in case of bt_name2string failure
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=32e2e5a42b2b

You are awesome, thank you!
diff mbox series

Patch

diff --git a/src/uuid-helper.c b/src/uuid-helper.c
index b62b1af82..9d19c5a29 100644
--- a/src/uuid-helper.c
+++ b/src/uuid-helper.c
@@ -169,7 +169,8 @@  static int string2uuid16(uuid_t *uuid, const char *string)
 char *bt_name2string(const char *pattern)
 {
 	uuid_t uuid;
-	uint16_t uuid16;
+	unsigned int uuid16;
+	char *endptr = NULL;
 	int i;
 
 	/* UUID 128 string format */
@@ -182,11 +183,9 @@  char *bt_name2string(const char *pattern)
 		goto proceed;
 
 	/* HEX format */
-	uuid16 = strtol(pattern, NULL, 16);
-	for (i = 0; bt_services[i].class; i++) {
-		if (bt_services[i].class == uuid16)
-			goto proceed;
-	}
+	uuid16 = strtoul(pattern, &endptr, 16);
+	if (uuid16 <= 0xffff && *endptr == '\0')
+		goto proceed;
 
 	return NULL;