Skip to contentSkip to conversation

monitor: fix usage of size_t %z formater

PATCH In review Brian Gix 3 participants 3 messages Jun 29, 2022 Bluetooth drivers

lore
Share & tools
lore

Brian Gix

author
#0 lore raw

PATCH 1/1 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(-)
monitor/l2cap.h +2 -2
index 00a8ffbbd..86113e59d 100644
@@ -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;
 }
Signature · 1 line
2.36.1
#1 lore raw

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

#2 lore raw
In reply to Brian Gix

Hi Brian,

Quoted 30 lines · Brian Gix

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(-)
monitor/l2cap.h +2 -3
index 00a8ffbbd..86113e59d 100644
@@ -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;
 }
--
Quoted 1 line

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);

Signature · 1 line
Luiz Augusto von Dentz