The current code assumes that FILEID_KERNFS filehandles will never grow
in size. This is not a safe assumption and userland shouldn't be trying
to guess the size of the filehandle it'll get.
We have a macro for that: MAX_HANDLE_SZ.
/* The structure to pass to name_to_handle_at() on cgroupfs2 */
typedef union {
struct file_handle file_handle;
- uint8_t space[offsetof(struct file_handle, f_handle) + sizeof(uint64_t)];
+ uint8_t space[MAX_HANDLE_SZ];
} cg_file_handle;
#define CG_FILE_HANDLE_INIT \
if (file_handle_supported) {
union {
struct file_handle file_handle;
- uint8_t space[offsetof(struct file_handle, f_handle) + sizeof(uint64_t)];
+ uint8_t space[MAX_HANDLE_SZ];
} fh = {
.file_handle.handle_bytes = sizeof(uint64_t),
.file_handle.handle_type = FILEID_KERNFS,