From b900a8d827e54c9274410d61fe2fc9874d5b7baa Mon Sep 17 00:00:00 2001 From: Jan Vaclav Date: Tue, 20 May 2025 12:07:43 +0200 Subject: [PATCH 1/2] pidfd-util: avoid alignment warning when accessing f_handle --- src/basic/pidfd-util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); From 4d2e61211df7244fae6aaeb8cae0916b4a0e78bd Mon Sep 17 00:00:00 2001 From: Jan Vaclav Date: Tue, 20 May 2025 12:16:31 +0200 Subject: [PATCH 2/2] cgroup-util: avoid alignment warning when accessing f_handle --- src/basic/cgroup-util.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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))