All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tests: fix format string mismatches on s390x/ppc64le
@ 2026-10-18  1:29 Pablo Alessandro Santos Hugen
  2026-10-19 17:13 ` Stephen Smalley
  0 siblings, 1 reply; 4+ messages in thread
From: Pablo Alessandro Santos Hugen @ 2026-10-18  1:29 UTC (permalink / raw)
  To: selinux

Cast printf arguments to match format specifiers across
filesystem/statfs_test.c, binder/{binder_common,client,manager,
service_provider}.c, and perf_event/perf_event.c. Types like
__fsword_t, binder_uintptr_t, binder_size_t and __s64 differ
in width across architectures, triggering -Wformat under -Werror.

Fixes: cb49040 ("tests: fail on compiler warnings and enable Wextra")
Signed-off-by: Pablo Alessandro Santos Hugen <phugen@redhat.com>
---
 tests/binder/binder_common.c    | 10 +++++-----
 tests/binder/client.c           |  4 ++--
 tests/binder/manager.c          |  2 +-
 tests/binder/service_provider.c |  4 ++--
 tests/filesystem/statfs_test.c  |  2 +-
 tests/perf_event/perf_event.c   |  4 ++--
 6 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/tests/binder/binder_common.c b/tests/binder/binder_common.c
index 7cf6c74..6f7e5b3 100644
--- a/tests/binder/binder_common.c
+++ b/tests/binder/binder_common.c
@@ -65,7 +65,7 @@ void print_trans_data(const struct binder_transaction_data *txn_in)
 	size_t count = txn_in->offsets_size / sizeof(binder_size_t);
 
 	printf("\thandle: %d\n", (uint32_t)txn_in->target.handle);
-	printf("\tcookie: %lld\n", txn_in->cookie);
+	printf("\tcookie: %lld\n", (long long)txn_in->cookie);
 	switch (txn_in->code) {
 	case TEST_SERVICE_ADD:
 		printf("\tcode: TEST_SERVICE_ADD\n");
@@ -101,8 +101,8 @@ void print_trans_data(const struct binder_transaction_data *txn_in)
 	}
 	printf("\tsender pid: %u\n", txn_in->sender_pid);
 	printf("\tsender euid: %u\n", txn_in->sender_euid);
-	printf("\tdata_size: %llu\n", txn_in->data_size);
-	printf("\toffsets_size: %llu\n", txn_in->offsets_size);
+	printf("\tdata_size: %llu\n", (unsigned long long)txn_in->data_size);
+	printf("\toffsets_size: %llu\n", (unsigned long long)txn_in->offsets_size);
 
 	while (count--) {
 		obj = (const struct flat_binder_object *)
@@ -111,7 +111,7 @@ void print_trans_data(const struct binder_transaction_data *txn_in)
 		switch (obj->hdr.type) {
 		case BINDER_TYPE_BINDER:
 			printf("\thdr: BINDER_TYPE_BINDER\n");
-			printf("\tbinder: %llx\n", obj->binder);
+			printf("\tbinder: %llx\n", (unsigned long long)obj->binder);
 			break;
 		case BINDER_TYPE_HANDLE:
 			printf("\thdr: BINDER_TYPE_HANDLE\n");
@@ -135,7 +135,7 @@ void print_trans_data(const struct binder_transaction_data *txn_in)
 		       obj->flags & FLAT_BINDER_FLAG_PRIORITY_MASK,
 		       obj->flags & FLAT_BINDER_FLAG_ACCEPTS_FDS ? "YES" : "NO");
 #endif
-		printf("\tcookie: %llx\n", obj->cookie);
+		printf("\tcookie: %llx\n", (unsigned long long)obj->cookie);
 	}
 	fflush(stdout);
 }
diff --git a/tests/binder/client.c b/tests/binder/client.c
index 220d37a..a35fd7b 100644
--- a/tests/binder/client.c
+++ b/tests/binder/client.c
@@ -111,7 +111,7 @@ static void extract_fd_and_respond(const struct binder_transaction_data *txn_in)
 
 	if (verbose)
 		printf("Client read_consumed: %lld\n",
-		       bwr.read_consumed);
+		       (long long)bwr.read_consumed);
 
 	cmd = binder_parse(obj->fd, (binder_uintptr_t)readbuf,
 			   bwr.read_consumed);
@@ -435,7 +435,7 @@ int main(int argc, char **argv)
 
 		if (verbose)
 			printf("Client read_consumed: %lld\n",
-			       bwr.read_consumed);
+			       (long long)bwr.read_consumed);
 
 		cmd = binder_parse(fd, (binder_uintptr_t)readbuf,
 				   bwr.read_consumed);
diff --git a/tests/binder/manager.c b/tests/binder/manager.c
index f7f1723..14e3e0c 100644
--- a/tests/binder/manager.c
+++ b/tests/binder/manager.c
@@ -349,7 +349,7 @@ int main(int argc, char **argv)
 
 		if (verbose)
 			printf("Manager read_consumed: %lld\n",
-			       bwr.read_consumed);
+			       (long long)bwr.read_consumed);
 
 		binder_parse(fd, (binder_uintptr_t)readbuf, bwr.read_consumed);
 	}
diff --git a/tests/binder/service_provider.c b/tests/binder/service_provider.c
index 1e6b490..40734a2 100644
--- a/tests/binder/service_provider.c
+++ b/tests/binder/service_provider.c
@@ -384,7 +384,7 @@ int main(int argc, char **argv)
 
 	if (verbose)
 		printf("Service Provider read_consumed: %lld\n",
-		       bwr.read_consumed);
+		       (long long)bwr.read_consumed);
 
 	cmd = binder_parse(fd, (binder_uintptr_t)readbuf,
 			   bwr.read_consumed);
@@ -455,7 +455,7 @@ int main(int argc, char **argv)
 
 		if (verbose)
 			printf("Service Provider read_consumed: %lld\n",
-			       bwr.read_consumed);
+			       (long long)bwr.read_consumed);
 
 		cmd = binder_parse(fd, (binder_uintptr_t)readbuf, bwr.read_consumed);
 
diff --git a/tests/filesystem/statfs_test.c b/tests/filesystem/statfs_test.c
index 310b66d..4a318d2 100644
--- a/tests/filesystem/statfs_test.c
+++ b/tests/filesystem/statfs_test.c
@@ -59,7 +59,7 @@ int main(int argc, char *argv[])
 
 	if (verbose)
 		printf("statfs(2) returned magic filesystem: 0x%lx\n",
-		       statfs_t.f_type);
+		       (unsigned long)statfs_t.f_type);
 
 	return 0;
 }
diff --git a/tests/perf_event/perf_event.c b/tests/perf_event/perf_event.c
index 0e8bdce..b8d3dae 100644
--- a/tests/perf_event/perf_event.c
+++ b/tests/perf_event/perf_event.c
@@ -161,7 +161,7 @@ int main(int argc, char **argv)
 		if (verbose) {
 			pe_page = base;
 			printf("perf mmap(2) return value: %lld\n",
-			       pe_page->offset);
+			       (long long)pe_page->offset);
 		}
 
 		munmap(base, mmap_size);
@@ -178,7 +178,7 @@ int main(int argc, char **argv)
 		}
 
 		if (verbose)
-			printf("perf read(2) return value: %lld\n", count);
+			printf("perf read(2) return value: %lld\n", (long long)count);
 
 		close(fd);
 	}
-- 
2.56.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] tests: fix format string mismatches on s390x/ppc64le
  2026-10-18  1:29 [PATCH] tests: fix format string mismatches on s390x/ppc64le Pablo Alessandro Santos Hugen
@ 2026-10-19 17:13 ` Stephen Smalley
  2026-10-20  8:57   ` Ondrej Mosnáček
  0 siblings, 1 reply; 4+ messages in thread
From: Stephen Smalley @ 2026-10-19 17:13 UTC (permalink / raw)
  To: Pablo Alessandro Santos Hugen, Ondrej Mosnáček; +Cc: selinux

On Sat, Oct 17, 2026 at 9:29 PM Pablo Alessandro Santos Hugen
<phugen@redhat.com> wrote:
>
> Cast printf arguments to match format specifiers across
> filesystem/statfs_test.c, binder/{binder_common,client,manager,
> service_provider}.c, and perf_event/perf_event.c. Types like
> __fsword_t, binder_uintptr_t, binder_size_t and __s64 differ
> in width across architectures, triggering -Wformat under -Werror.
>
> Fixes: cb49040 ("tests: fail on compiler warnings and enable Wextra")
> Signed-off-by: Pablo Alessandro Santos Hugen <phugen@redhat.com>

This looks like it was prepared against a tree before Ondrej's series landed.
As far as I can tell, all of these fixes are already addressed on the
main branch except for one residual cast that isn't actually needed.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] tests: fix format string mismatches on s390x/ppc64le
  2026-10-19 17:13 ` Stephen Smalley
@ 2026-10-20  8:57   ` Ondrej Mosnáček
  2026-10-20 16:43     ` Pablo Hugen
  0 siblings, 1 reply; 4+ messages in thread
From: Ondrej Mosnáček @ 2026-10-20  8:57 UTC (permalink / raw)
  To: Stephen Smalley; +Cc: Pablo Alessandro Santos Hugen, selinux

On Mon, 19 Oct 2026 at 19:13, Stephen Smalley
<stephen.smalley.work@gmail.com> wrote:
>
> On Sat, Oct 17, 2026 at 9:29 PM Pablo Alessandro Santos Hugen
> <phugen@redhat.com> wrote:
> >
> > Cast printf arguments to match format specifiers across
> > filesystem/statfs_test.c, binder/{binder_common,client,manager,
> > service_provider}.c, and perf_event/perf_event.c. Types like
> > __fsword_t, binder_uintptr_t, binder_size_t and __s64 differ
> > in width across architectures, triggering -Wformat under -Werror.
> >
> > Fixes: cb49040 ("tests: fail on compiler warnings and enable Wextra")
> > Signed-off-by: Pablo Alessandro Santos Hugen <phugen@redhat.com>
>
> This looks like it was prepared against a tree before Ondrej's series landed.
> As far as I can tell, all of these fixes are already addressed on the
> main branch except for one residual cast that isn't actually needed.

Yes, this is already fixed by:
https://github.com/SELinuxProject/selinux-testsuite/commit/705ddfdc5ae5217344eecc8d4352e7f3dc52e772
https://github.com/SELinuxProject/selinux-testsuite/commit/6fa2143aec27d0ac3ad4cb3fd76f747ab198ac1f
https://github.com/SELinuxProject/selinux-testsuite/commit/bf477b4e3df60b63553712fce6e07c97881dc6b6

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] tests: fix format string mismatches on s390x/ppc64le
  2026-10-20  8:57   ` Ondrej Mosnáček
@ 2026-10-20 16:43     ` Pablo Hugen
  0 siblings, 0 replies; 4+ messages in thread
From: Pablo Hugen @ 2026-10-20 16:43 UTC (permalink / raw)
  To: Ondrej Mosnáček, Stephen Smalley
  Cc: Pablo Alessandro Santos Hugen, selinux

[-- Attachment #1: Type: text/plain, Size: 148 bytes --]

Yes that was the case. I've created the patches from an mirror which I
thought was updated.

Anyways, thanks for the reviews!!!

Best,
Pablo

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-10-20 16:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-18  1:29 [PATCH] tests: fix format string mismatches on s390x/ppc64le Pablo Alessandro Santos Hugen
2026-10-19 17:13 ` Stephen Smalley
2026-10-20  8:57   ` Ondrej Mosnáček
2026-10-20 16:43     ` Pablo Hugen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.