linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kbuffer: fix endianness flags for big-endian host
@ 2025-11-04  8:45 Bastien Curutchet
  0 siblings, 0 replies; only message in thread
From: Bastien Curutchet @ 2025-11-04  8:45 UTC (permalink / raw)
  To: linux-trace-devel; +Cc: Thomas Petazzoni, Bastien Curutchet

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.

Signed-off-by: Bastien Curutchet <bastien.curutchet@bootlin.com>
Fixes: 5f2aa8497c5b ("libtraceevent kbuffer: Add SAME_AS_HOST for endian and size")
---
 src/kbuffer-parse.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/kbuffer-parse.c b/src/kbuffer-parse.c
index 71291adf0860b8392e6cfa0b0640c6472def422c..232d1688934a946e19f52886c2d25e4c73637b4c 100644
--- a/src/kbuffer-parse.c
+++ b/src/kbuffer-parse.c
@@ -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,
-- 
Bastien Curutchet <bastien.curutchet@bootlin.com>


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2025-11-04  8:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-04  8:45 [PATCH] kbuffer: fix endianness flags for big-endian host Bastien Curutchet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).