aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2026-01-12 04:46:15 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2026-01-20 14:42:35 +0000
commitbe1b2da855cc38531733b5c97891cd4a40a993bc (patch)
tree9c316530c0567d68e5fb886f86a8459c73208223
parent96acaa960023c20e852e04e7cc5c6a5faca36c67 (diff)
sys/abi_compat.h: fix UB for bintime32 handling
Do not cast and then access potentially unaligned uint64_t in the BT_CP() macro. Use freebsd32_uint64_t type and FU64_CP() for the frac member. Noted by: des Reviewed by: des, emaste Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D54663
-rw-r--r--sys/compat/freebsd32/freebsd32.h2
-rw-r--r--sys/sys/abi_compat.h2
2 files changed, 2 insertions, 2 deletions
diff --git a/sys/compat/freebsd32/freebsd32.h b/sys/compat/freebsd32/freebsd32.h
index 7324f9adf70c..7d21a5be5570 100644
--- a/sys/compat/freebsd32/freebsd32.h
+++ b/sys/compat/freebsd32/freebsd32.h
@@ -70,7 +70,7 @@ struct itimerspec32 {
struct bintime32 {
time32_t sec;
- uint32_t frac[2];
+ freebsd32_uint64_t frac;
};
struct ffclock_estimate32 {
diff --git a/sys/sys/abi_compat.h b/sys/sys/abi_compat.h
index 0a7110191430..bd99a21d8e23 100644
--- a/sys/sys/abi_compat.h
+++ b/sys/sys/abi_compat.h
@@ -77,7 +77,7 @@
#define BT_CP(src, dst, fld) do { \
CP((src).fld, (dst).fld, sec); \
- *(uint64_t *)&(dst).fld.frac[0] = (src).fld.frac; \
+ FU64_CP((src).fld, (dst).fld, frac); \
} while (0)
#endif /* !_COMPAT_H_ */