diff --git a/src/basic/cgroup-util.h b/src/basic/cgroup-util.h index 1d67174b43..42c03e54b7 100644 --- a/src/basic/cgroup-util.h +++ b/src/basic/cgroup-util.h @@ -332,4 +332,4 @@ typedef union { .file_handle.handle_type = FILEID_KERNFS, \ } -#define CG_FILE_HANDLE_CGROUPID(fh) (*(uint64_t*) (fh).file_handle.f_handle) +#define CG_FILE_HANDLE_CGROUPID(fh) (*CAST_ALIGN_PTR(uint64_t, (fh).file_handle.f_handle)) diff --git a/src/basic/pidfd-util.c b/src/basic/pidfd-util.c index 52a371ba1a..54724a40b0 100644 --- a/src/basic/pidfd-util.c +++ b/src/basic/pidfd-util.c @@ -248,7 +248,7 @@ int pidfd_get_inode_id(int fd, uint64_t *ret) { r = RET_NERRNO(name_to_handle_at(fd, "", &fh.file_handle, &mnt_id, AT_EMPTY_PATH)); if (r >= 0) { if (ret) - *ret = *(uint64_t*) fh.file_handle.f_handle; + *ret = *CAST_ALIGN_PTR(uint64_t, fh.file_handle.f_handle); return 0; } assert(r != -EOVERFLOW);