From c46fda904f38a66f5f68a4b766438c09ef8cddcc Mon Sep 17 00:00:00 2001 From: =?utf8?q?S=C3=A9bastien=20Bouchex=20Bellomi=C3=A9?= Date: Tue, 11 Mar 2014 08:54:27 -0600 Subject: [PATCH] Fix pointer alignment bug causing SIGBUS on Sparc64 OK, the issue was related to the alignment issue between the thread_options structure and its "packed" version : The lexxx_to_cpu macros are incorrectly casting the pointers and that causes an bus error. I have fixed the issue by avoid casting the pointers and calling directly the "swap" method. I have also included a fixed on the thread_options structure regarding the ddir_seq_add variable : Its length was incorrect. Signed-off-by: Jens Axboe --- os/os.h | 18 ++++++------------ thread_options.h | 2 +- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/os/os.h b/os/os.h index 7f92d1bc..2f2d0698 100644 --- a/os/os.h +++ b/os/os.h @@ -201,28 +201,22 @@ static inline uint64_t fio_swap64(uint64_t val) #endif /* FIO_HAVE_BYTEORDER_FUNCS */ #define le16_to_cpu(val) ({ \ - uint16_t *__val = &(val); \ - __le16_to_cpu(*__val); \ + __le16_to_cpu(val); \ }) #define le32_to_cpu(val) ({ \ - uint32_t *__val = &(val); \ - __le32_to_cpu(*__val); \ + __le32_to_cpu(val); \ }) #define le64_to_cpu(val) ({ \ - uint64_t *__val = &(val); \ - __le64_to_cpu(*__val); \ + __le64_to_cpu(val); \ }) #define cpu_to_le16(val) ({ \ - uint16_t *__val = &(val); \ - __cpu_to_le16(*__val); \ + __cpu_to_le16(val); \ }) #define cpu_to_le32(val) ({ \ - uint32_t *__val = &(val); \ - __cpu_to_le32(*__val); \ + __cpu_to_le32(val); \ }) #define cpu_to_le64(val) ({ \ - uint64_t *__val = &(val); \ - __cpu_to_le64(*__val); \ + __cpu_to_le64(val); \ }) #ifndef FIO_HAVE_BLKTRACE diff --git a/thread_options.h b/thread_options.h index 4ea6ebd0..bacd86b4 100644 --- a/thread_options.h +++ b/thread_options.h @@ -45,7 +45,7 @@ struct thread_options { unsigned int kb_base; unsigned int unit_base; unsigned int ddir_seq_nr; - long ddir_seq_add; + long long ddir_seq_add; unsigned int iodepth; unsigned int iodepth_low; unsigned int iodepth_batch; -- 2.25.1