2022-06-29 19:49:59

by Gix, Brian

[permalink] [raw]
Subject: [PATCH BlueZ] monitor: fix usage of size_t %z formater

Some versions of GCC use strict typing for the %z formater, so passing
an argument of type uint64_t instead of size_t throws an error.
---
monitor/l2cap.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/monitor/l2cap.h b/monitor/l2cap.h
index 00a8ffbbd..86113e59d 100644
--- a/monitor/l2cap.h
+++ b/monitor/l2cap.h
@@ -291,7 +291,7 @@ static inline bool l2cap_frame_print_be64(struct l2cap_frame *frame,
return false;
}

- print_field("%s: 0x%zx", label, u64);
+ print_field("%s: 0x%zx", label, (size_t)u64);

return true;
}
@@ -320,7 +320,7 @@ static inline bool l2cap_frame_print_le64(struct l2cap_frame *frame,
return false;
}

- print_field("%s: 0x%zx", label, u64);
+ print_field("%s: 0x%zx", label, (size_t)u64);

return true;
}
--
2.36.1


2022-06-29 21:37:17

by bluez.test.bot

[permalink] [raw]
Subject: RE: [BlueZ] monitor: fix usage of size_t %z formater

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=655153

---Test result---

Test Summary:
CheckPatch PASS 0.75 seconds
GitLint PASS 0.53 seconds
Prep - Setup ELL PASS 42.41 seconds
Build - Prep PASS 0.50 seconds
Build - Configure PASS 8.27 seconds
Build - Make PASS 1398.73 seconds
Make Check PASS 11.07 seconds
Make Check w/Valgrind PASS 430.93 seconds
Make Distcheck PASS 228.60 seconds
Build w/ext ELL - Configure PASS 8.40 seconds
Build w/ext ELL - Make PASS 1384.88 seconds
Incremental Build with patchesPASS 0.00 seconds



---
Regards,
Linux Bluetooth

2022-06-30 00:10:41

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: Re: [PATCH BlueZ] monitor: fix usage of size_t %z formater

Hi Brian,

On Wed, Jun 29, 2022 at 12:49 PM Brian Gix <[email protected]> wrote:
>
> Some versions of GCC use strict typing for the %z formater, so passing
> an argument of type uint64_t instead of size_t throws an error.
> ---
> monitor/l2cap.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/monitor/l2cap.h b/monitor/l2cap.h
> index 00a8ffbbd..86113e59d 100644
> --- a/monitor/l2cap.h
> +++ b/monitor/l2cap.h
> @@ -291,7 +291,7 @@ static inline bool l2cap_frame_print_be64(struct l2cap_frame *frame,
> return false;
> }
>
> - print_field("%s: 0x%zx", label, u64);
> + print_field("%s: 0x%zx", label, (size_t)u64);
>
> return true;
> }
> @@ -320,7 +320,7 @@ static inline bool l2cap_frame_print_le64(struct l2cap_frame *frame,
> return false;
> }
>
> - print_field("%s: 0x%zx", label, u64);
> + print_field("%s: 0x%zx", label, (size_t)u64);
>
> return true;
> }
> --
> 2.36.1

I suspend we need to use something like PRIu64 macros, like we already
do in some of our code e.g.:

src/adapter.c: sscanf(rand, "%" PRIu64, &ltk->rand);


--
Luiz Augusto von Dentz