Skip to contentSkip to conversation

trace-cmd: fix writing of uncompressed size

PATCH In review Sven Schnelle 3 participants 5 messages Jul 11, 2022 – Jul 12, 2022 s390

lore
Share & tools
lore

Sven Schnelle

author reviewer
#0 lore raw

PATCH v2 1/1 trace-cmd: fix writing of uncompressed size

pointer in struct tracecmd_compression is 'unsigned long', which is 8 byte in size on most platforms, but the tep_read_number() call in the next line treats it as a 4 byte value. As there's no need for unsigned long change the type to unsigned int.

Fixes 3f8447b1 ("trace-cmd library: Add support for compression algorithms")
---
 lib/trace-cmd/trace-compress.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/trace-cmd/trace-compress.c +1 -1
index a63295e..461de8d 100644
@@ -32,7 +32,7 @@ struct tracecmd_compression {
 	int				fd;
 	unsigned int			capacity;
 	unsigned int			capacity_read;
-	unsigned long			pointer;
+	unsigned int			pointer;
 	char				*buffer;
 	struct compress_proto		*proto;
 	struct tep_handle		*tep;
Signature · 1 line
2.36.1
Acked-by on v2 1/1
#1 lore raw
Quoted 8 lines · Sven Schnelle

pointer in struct tracecmd_compression is 'unsigned long', which is 8 byte in size on most platforms, but the tep_read_number() call in the next line treats it as a 4 byte value. As there's no need for unsigned long change the type to unsigned int.

Fixes 3f8447b1 ("trace-cmd library: Add support for compression algorithms")

Thanks!

Quoted 20 lines
---
 lib/trace-cmd/trace-compress.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/trace-cmd/trace-compress.c +1 -2
index a63295e..461de8d 100644
@@ -32,7 +32,7 @@ struct tracecmd_compression {
        int                             fd;
        unsigned int                    capacity;
        unsigned int                    capacity_read;
-       unsigned long                   pointer;
+       unsigned int                    pointer;
        char                            *buffer;
        struct compress_proto           *proto;
        struct tep_handle               *tep;
--

2.36.1

Signature · 2 lines
Tzvetomir (Ceco) Stoyanov
VMware Open Source Technology Center
#2 lore raw
In reply to Sven Schnelle
Quoted 7 lines · On Mon, 11 Jul 2022 11:43:40 +0200 Sven Schnelle <[email protected]> wrote:

pointer in struct tracecmd_compression is 'unsigned long', which is 8 byte in size on most platforms, but the tep_read_number() call in the next line treats it as a 4 byte value. As there's no need for unsigned long change the type to unsigned int.

Fixes 3f8447b1 ("trace-cmd library: Add support for compression algorithms")

Hi Sven,

Can you resend and Cc [email protected] so that it gets added to patchwork.

Thanks!

-- Steve

Quoted 17 lines
---
 lib/trace-cmd/trace-compress.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/trace-cmd/trace-compress.c +1 -1
index a63295e..461de8d 100644
@@ -32,7 +32,7 @@ struct tracecmd_compression {
 	int				fd;
 	unsigned int			capacity;
 	unsigned int			capacity_read;
-	unsigned long			pointer;
+	unsigned int			pointer;
 	char				*buffer;
 	struct compress_proto		*proto;
 	struct tep_handle		*tep;
author reviewer
#4 lore raw

Hi Steve,

Quoted 7 lines · Steven Rostedt
Quoted 2 lines · On Mon, 11 Jul 2022 13:51:46 -0400 Steven Rostedt <[email protected]> wrote:

Can you resend and Cc [email protected] so that it gets added to patchwork.

Actually, I'll just send it for you ;-)

Thank you! :-)