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:
@@ -70,7 +70,7 @@ struct itimerspec32 {
|
||||
|
||||
struct bintime32 {
|
||||
time32_t sec;
|
||||
uint32_t frac[2];
|
||||
freebsd32_uint64_t frac;
|
||||
};
|
||||
|
||||
struct ffclock_estimate32 {
|
||||
|
||||
@@ -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_ */
|
||||
|
||||
Reference in New Issue
Block a user