fanotify: Drop use of flex array in fanotify_fh
authorJan Kara <jack@suse.cz>
Tue, 13 May 2025 13:17:46 +0000 (15:17 +0200)
committerJan Kara <jack@suse.cz>
Wed, 14 May 2025 09:06:56 +0000 (11:06 +0200)
commitb9b410cc1875120a0a2f84fd61c026cc994049e2
tree2030c9f7b8768e1d3d1f26d0404bd043363b0215
parente48e99b6edf41c69c5528aa7ffb2daf3c59ee105
fanotify: Drop use of flex array in fanotify_fh

We use flex array 'buf' in fanotify_fh to contain the file handle
content. However the buffer is not a proper flex array. It has a
preconfigured fixed size. Furthermore if fixed size is not big enough,
we use external separately allocated buffer. Hence don't pretend buf is
a flex array since we have to use special accessors anyway and instead
just modify the accessors to do the pointer math without flex array.
This fixes warnings that flex array is not the last struct member in
fanotify_fid_event or fanotify_error_event.

Signed-off-by: Jan Kara <jack@suse.cz>
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Link: https://patch.msgid.link/20250513131745.2808-2-jack@suse.cz
fs/notify/fanotify/fanotify.c
fs/notify/fanotify/fanotify.h