diff mbox series

[2/2] trace-cmd lib: Use proper printf format specifiers

Message ID 20240911163653.12606-3-jjindrak@suse.cz (mailing list archive)
State Accepted
Commit 9da3427e1cc16231c0d5a025797dd4d268983036
Headers show
Series trace-cmd lib: Fix potential integer overflows | expand

Commit Message

jjindrak@suse.cz Sept. 11, 2024, 4:36 p.m. UTC
From: Jaroslav Jindrak <jjindrak@suse.cz>

One of the warnings in out_write_cpu_data() printfs two
unsigned long long values as signed long long:

	tracecmd_warning("did not match size of %lld to %lld",
			 read_size, data_files[i].file_size);

This can lead to misleading values in a warning:

libtracecmd: Invalid argument
  did not match size of 3451486208 to -843481088

Signed-off-by: Jaroslav Jindrak <jjindrak@suse.cz>
---
 lib/trace-cmd/trace-output.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/lib/trace-cmd/trace-output.c b/lib/trace-cmd/trace-output.c
index 731f08dd..7b4b4b49 100644
--- a/lib/trace-cmd/trace-output.c
+++ b/lib/trace-cmd/trace-output.c
@@ -2683,7 +2683,7 @@  __hidden int out_write_cpu_data(struct tracecmd_output *handle,
 
 			if (read_size != data_files[i].file_size) {
 				errno = EINVAL;
-				tracecmd_warning("did not match size of %lld to %lld",
+				tracecmd_warning("did not match size of %llu to %llu",
 						 read_size, data_files[i].file_size);
 				goto out_free;
 			}