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
This commit is contained in:
Konstantin Belousov
2026-01-12 06:46:15 +02:00
parent 96acaa9600
commit be1b2da855
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -70,7 +70,7 @@ struct itimerspec32 {
struct bintime32 {
time32_t sec;
uint32_t frac[2];
freebsd32_uint64_t frac;
};
struct ffclock_estimate32 {
+1 -1
View File
@@ -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_ */