kbuffer: fix endianness flags for big-endian host
PATCH 1/1 kbuffer: fix endianness flags for big-endian host
When KBUFFER_ENDIAN_SAME_AS_HOST is set on a big-endian host, the KBUFFER_FL_BIG_ENDIAN flag is added to the local flags variable instead of the kbuf->flags. Since the local flags variable has already been copied to kbuf->flags at that time, the KBUFFER_FL_BIG_ENDIAN flag is lost when we leave the function.
Add KBUFFER_FL_BIG_ENDIAN to the kbuf->flags when KBUFFER_ENDIAN_SAME_AS_HOST is used on a big-endian host.
--- src/kbuffer-parse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
src/kbuffer-parse.c +1 -1
@@ -247,7 +247,7 @@ kbuffer_alloc(enum kbuffer_long_size size, enum kbuffer_endian endian)if (host_is_bigendian ()) {if (endian ==KBUFFER_ENDIAN_SAME_AS_HOST ) - flags |=KBUFFER_FL_BIG_ENDIAN ; + kbuf->flags |=KBUFFER_FL_BIG_ENDIAN ; kbuf->flags |=KBUFFER_FL_HOST_BIG_ENDIAN ; }
---
base-commit: b3f5849527ae226b88342ef80fc42c66ab206f99
change-id: 20251028-fix-parse-7395a8571b72
Best regards,
Signature · 1 line
Bastien Curutchet <[email protected]>
Hi all,
Gentle ping here, has anyone had the chance to take a look at it ?
Best regards,
Bastien
Quoted 34 lines · Bastien Curutchet
When
KBUFFER_ENDIAN_SAME_AS_HOSTis set on a big-endian host, theKBUFFER_FL_BIG_ENDIANflag is added to the local flags variable instead of thekbuf->flags. Since the local flags variable has already been copied tokbuf->flagsat that time, theKBUFFER_FL_BIG_ENDIANflag is lost when we leave the function.Add
KBUFFER_FL_BIG_ENDIANto thekbuf->flagswhenKBUFFER_ENDIAN_SAME_AS_HOSTis used on a big-endian host.Signed-off-by Bastien Curutchet <[email protected]>Fixes 5f2aa8497c5b ("libtraceevent kbuffer: Add SAME_AS_HOST for endian and size")--- src/kbuffer-parse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)src/kbuffer-parse.c +1
-2@@ -247,7 +247,7 @@ kbuffer_alloc(enum kbuffer_long_size size, enum kbuffer_endian endian)if (host_is_bigendian ()) {if (endian ==KBUFFER_ENDIAN_SAME_AS_HOST ) - flags |=KBUFFER_FL_BIG_ENDIAN ; + kbuf->flags |=KBUFFER_FL_BIG_ENDIAN ; kbuf->flags |=KBUFFER_FL_HOST_BIG_ENDIAN ; } ---base-commit:
b3f5849527ae226b88342ef80fc42c66ab206f99
change-id: 20251028-fix-parse-7395a8571b72Best regards,
Quoted 4 lines · On Thu, 27 Nov 2025 15:44:21 +0100 Bastien Curutchet…
Hi all,
Gentle ping here, has anyone had the chance to take a look at it ?
It's already been applied:
-- Steve