* [PATCH BlueZ v2 0/2] Fix 32 bit Compiler Errors @ 2021-01-27 18:23 Brian Gix 2021-01-27 18:23 ` [PATCH BlueZ v2 1/2] advertising: Make data size explicit for formats Brian Gix 2021-01-27 18:23 ` [PATCH BlueZ v2 2/2] tools/mgmt-tester: Make data size explicit for log Brian Gix 0 siblings, 2 replies; 4+ messages in thread From: Brian Gix @ 2021-01-27 18:23 UTC (permalink / raw) To: linux-bluetooth; +Cc: luiz.dentz, brian.gix In a couple places the sizeof() macro has been assumed to return a (long unsigned) value, and so the string formater %lu has been used to print out warnings derived from this assumption. While correct on 64 bit systems, this is an incorrect assumption on 32 bit systems. These two changes explicitly cast the sizeof return to long in the affected cases. v2: Fix bluez.test.bot warnings Brian Gix (2): advertising: Make data size explicit for formats tools/mgmt-tester: Make data size explicit for log src/advertising.c | 2 +- tools/mgmt-tester.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) -- 2.25.4 ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH BlueZ v2 1/2] advertising: Make data size explicit for formats 2021-01-27 18:23 [PATCH BlueZ v2 0/2] Fix 32 bit Compiler Errors Brian Gix @ 2021-01-27 18:23 ` Brian Gix 2021-01-27 18:50 ` Fix 32 bit Compiler Errors bluez.test.bot 2021-01-27 18:23 ` [PATCH BlueZ v2 2/2] tools/mgmt-tester: Make data size explicit for log Brian Gix 1 sibling, 1 reply; 4+ messages in thread From: Brian Gix @ 2021-01-27 18:23 UTC (permalink / raw) To: linux-bluetooth; +Cc: luiz.dentz, brian.gix On some 32 bit systems sizeof does not return (unsigned long) Fixes the error: In file included from src/advertising.c:30: src/advertising.c: In function ‘read_controller_cap_complete’: src/log.h:60:20: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 5 has type ‘unsigned int’ [-Werror=format=] 60 | btd_error(0xffff, "%s:%s() " fmt, __FILE__, __func__, ## arg) | ^~~~~~~~~~ src/advertising.c:1757:3: note: in expansion of macro ‘error’ 1757 | error("Controller capabilities malformed, size %lu != %u", | ^~~~~ src/advertising.c:1757:52: note: format string is defined here 1757 | error("Controller capabilities malformed, size %lu != %u", | ~~^ | | | long unsigned int | %u --- src/advertising.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/advertising.c b/src/advertising.c index 4f5123fa1..36e737987 100644 --- a/src/advertising.c +++ b/src/advertising.c @@ -1755,7 +1755,7 @@ static void read_controller_cap_complete(uint8_t status, uint16_t length, if (sizeof(rp->cap_len) + rp->cap_len != length) { error("Controller capabilities malformed, size %lu != %u", - sizeof(rp->cap_len) + rp->cap_len, length); + (long) sizeof(rp->cap_len) + rp->cap_len, length); return; } -- 2.25.4 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* RE: Fix 32 bit Compiler Errors 2021-01-27 18:23 ` [PATCH BlueZ v2 1/2] advertising: Make data size explicit for formats Brian Gix @ 2021-01-27 18:50 ` bluez.test.bot 0 siblings, 0 replies; 4+ messages in thread From: bluez.test.bot @ 2021-01-27 18:50 UTC (permalink / raw) To: linux-bluetooth, brian.gix [-- Attachment #1: Type: text/plain, Size: 2181 bytes --] 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=423149 ---Test result--- ############################## Test: CheckPatch - FAIL Output: advertising: Make data size explicit for formats WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description (prefer a maximum 75 chars per line) #16: unsigned int’, but argument 5 has type ‘unsigned int’ [-Werror=format=] - total: 0 errors, 1 warnings, 8 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. "[PATCH] advertising: Make data size explicit for formats" has style problems, please review. NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPLIT_STRING SSCANF_TO_KSTRTO NOTE: If any of the errors are false positives, please report them to the maintainer, see CHECKPATCH in MAINTAINERS. tools/mgmt-tester: Make data size explicit for log WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description (prefer a maximum 75 chars per line) #15: ‘long unsigned int’, but argument 2 has type ‘unsigned int’ [-Werror=format=] - total: 0 errors, 1 warnings, 8 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. "[PATCH] tools/mgmt-tester: Make data size explicit for log" has style problems, please review. NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPLIT_STRING SSCANF_TO_KSTRTO NOTE: If any of the errors are false positives, please report them to the maintainer, see CHECKPATCH in MAINTAINERS. ############################## Test: CheckGitLint - PASS ############################## Test: CheckBuild - PASS ############################## Test: MakeCheck - PASS --- Regards, Linux Bluetooth ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH BlueZ v2 2/2] tools/mgmt-tester: Make data size explicit for log 2021-01-27 18:23 [PATCH BlueZ v2 0/2] Fix 32 bit Compiler Errors Brian Gix 2021-01-27 18:23 ` [PATCH BlueZ v2 1/2] advertising: Make data size explicit for formats Brian Gix @ 2021-01-27 18:23 ` Brian Gix 1 sibling, 0 replies; 4+ messages in thread From: Brian Gix @ 2021-01-27 18:23 UTC (permalink / raw) To: linux-bluetooth; +Cc: luiz.dentz, brian.gix On 32 bit systems, sizeof macro doesn't always return (unsigned long) Fix following error: tools/mgmt-tester.c: In function ‘read_50_controller_cap_complete’: tools/mgmt-tester.c:9124:58: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 2 has type ‘unsigned int’ [-Werror=format=] 9124 | tester_warn("Controller capabilities malformed, size %lu != %u", | ~~^ | | | long unsigned int | %u 9125 | sizeof(rp->cap_len) + rp->cap_len, length); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | unsigned int --- tools/mgmt-tester.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/mgmt-tester.c b/tools/mgmt-tester.c index fe73a6d89..6bc40181e 100644 --- a/tools/mgmt-tester.c +++ b/tools/mgmt-tester.c @@ -9122,7 +9122,7 @@ static void read_50_controller_cap_complete(uint8_t status, uint16_t length, if (sizeof(rp->cap_len) + rp->cap_len != length) { tester_warn("Controller capabilities malformed, size %lu != %u", - sizeof(rp->cap_len) + rp->cap_len, length); + (long) sizeof(rp->cap_len) + rp->cap_len, length); tester_test_failed(); } -- 2.25.4 ^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-01-27 18:51 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2021-01-27 18:23 [PATCH BlueZ v2 0/2] Fix 32 bit Compiler Errors Brian Gix 2021-01-27 18:23 ` [PATCH BlueZ v2 1/2] advertising: Make data size explicit for formats Brian Gix 2021-01-27 18:50 ` Fix 32 bit Compiler Errors bluez.test.bot 2021-01-27 18:23 ` [PATCH BlueZ v2 2/2] tools/mgmt-tester: Make data size explicit for log Brian Gix
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).