Message ID | 20210905154356.8296-1-pav@iki.fi |
---|---|
State | New |
Headers | show |
Series | [BlueZ,v2,1/2] shared/util: use 64-bit bitmap in util_get/clear_uid | expand |
Hi Pauli, On Sun, Sep 5, 2021 at 10:01 AM <bluez.test.bot@gmail.com> wrote: > > 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=542233 > > ---Test result--- > > Test Summary: > CheckPatch PASS 0.30 seconds > GitLint PASS 0.11 seconds > Prep - Setup ELL PASS 44.86 seconds > Build - Prep PASS 0.10 seconds > Build - Configure PASS 7.75 seconds > Build - Make PASS 192.81 seconds > Make Check PASS 9.37 seconds > Make Distcheck PASS 229.33 seconds > Build w/ext ELL - Configure PASS 8.02 seconds > Build w/ext ELL - Make PASS 181.60 seconds > > Details > ############################## > Test: CheckPatch - PASS > Desc: Run checkpatch.pl script with rule in .checkpatch.conf > > ############################## > Test: GitLint - PASS > Desc: Run gitlint with rule in .gitlint > > ############################## > Test: Prep - Setup ELL - PASS > Desc: Clone, build, and install ELL > > ############################## > Test: Build - Prep - PASS > Desc: Prepare environment for build > > ############################## > Test: Build - Configure - PASS > Desc: Configure the BlueZ source tree > > ############################## > Test: Build - Make - PASS > Desc: Build the BlueZ source tree > > ############################## > Test: Make Check - PASS > Desc: Run 'make check' > > ############################## > Test: Make Distcheck - PASS > Desc: Run distcheck to check the distribution > > ############################## > Test: Build w/ext ELL - Configure - PASS > Desc: Configure BlueZ source with '--enable-external-ell' configuration > > ############################## > Test: Build w/ext ELL - Make - PASS > Desc: Build BlueZ source with '--enable-external-ell' configuration > > > > --- > Regards, > Linux Bluetooth Applied, thanks. -- Luiz Augusto von Dentz
diff --git a/android/avdtp.c b/android/avdtp.c index 8c2930ec1..a261a8e5f 100644 --- a/android/avdtp.c +++ b/android/avdtp.c @@ -34,7 +34,7 @@ #include "../profiles/audio/a2dp-codecs.h" #define MAX_SEID 0x3E -static unsigned int seids; +static uint64_t seids; #ifndef MAX # define MAX(x, y) ((x) > (y) ? (x) : (y)) diff --git a/profiles/audio/avdtp.c b/profiles/audio/avdtp.c index 946231b71..25520ceec 100644 --- a/profiles/audio/avdtp.c +++ b/profiles/audio/avdtp.c @@ -44,7 +44,7 @@ #define AVDTP_PSM 25 #define MAX_SEID 0x3E -static unsigned int seids; +static uint64_t seids; #ifndef MAX # define MAX(x, y) ((x) > (y) ? (x) : (y)) diff --git a/src/advertising.c b/src/advertising.c index bd79454d5..41b818650 100644 --- a/src/advertising.c +++ b/src/advertising.c @@ -48,7 +48,7 @@ struct btd_adv_manager { uint8_t max_scan_rsp_len; uint8_t max_ads; uint32_t supported_flags; - unsigned int instance_bitmap; + uint64_t instance_bitmap; bool extended_add_cmds; int8_t min_tx_power; int8_t max_tx_power; diff --git a/src/shared/util.c b/src/shared/util.c index 244756456..2887a3efa 100644 --- a/src/shared/util.c +++ b/src/shared/util.c @@ -124,30 +124,28 @@ unsigned char util_get_dt(const char *parent, const char *name) /* Helpers for bitfield operations */ -/* Find unique id in range from 1 to max but no bigger then - * sizeof(int) * 8. ffs() is used since it is POSIX standard - */ -uint8_t util_get_uid(unsigned int *bitmap, uint8_t max) +/* Find unique id in range from 1 to max but no bigger than 64. */ +uint8_t util_get_uid(uint64_t *bitmap, uint8_t max) { uint8_t id; - id = ffs(~*bitmap); + id = ffsll(~*bitmap); if (!id || id > max) return 0; - *bitmap |= 1u << (id - 1); + *bitmap |= ((uint64_t)1) << (id - 1); return id; } /* Clear id bit in bitmap */ -void util_clear_uid(unsigned int *bitmap, uint8_t id) +void util_clear_uid(uint64_t *bitmap, uint8_t id) { - if (!id) + if (!id || id > 64) return; - *bitmap &= ~(1u << (id - 1)); + *bitmap &= ~(((uint64_t)1) << (id - 1)); } static const struct { diff --git a/src/shared/util.h b/src/shared/util.h index 9920b7f76..60908371d 100644 --- a/src/shared/util.h +++ b/src/shared/util.h @@ -102,8 +102,8 @@ void util_hexdump(const char dir, const unsigned char *buf, size_t len, unsigned char util_get_dt(const char *parent, const char *name); -uint8_t util_get_uid(unsigned int *bitmap, uint8_t max); -void util_clear_uid(unsigned int *bitmap, uint8_t id); +uint8_t util_get_uid(uint64_t *bitmap, uint8_t max); +void util_clear_uid(uint64_t *bitmap, uint8_t id); const char *bt_uuid16_to_str(uint16_t uuid); const char *bt_uuid32_to_str(uint32_t uuid); diff --git a/unit/test-avdtp.c b/unit/test-avdtp.c index f5340d6f3..4e8a68c6b 100644 --- a/unit/test-avdtp.c +++ b/unit/test-avdtp.c @@ -550,7 +550,7 @@ static void test_server_seid(gconstpointer data) struct avdtp_local_sep *sep; unsigned int i; - for (i = 0; i < sizeof(int) * 8; i++) { + for (i = 0; i < MAX_SEID; i++) { sep = avdtp_register_sep(context->lseps, AVDTP_SEP_TYPE_SINK, AVDTP_MEDIA_TYPE_AUDIO, 0x00, TRUE, &sep_ind, NULL,