]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
fanotify: rename a misnamed constant
authorAmir Goldstein <amir73il@gmail.com>
Fri, 15 Nov 2024 15:30:18 +0000 (10:30 -0500)
committerJan Kara <jack@suse.cz>
Tue, 10 Dec 2024 11:03:16 +0000 (12:03 +0100)
FANOTIFY_PIDFD_INFO_HDR_LEN is not the length of the header.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Link: https://patch.msgid.link/8776ab90fe538225aeb561c560296bafd16b97c4.1731684329.git.josef@toxicpanda.com
fs/notify/fanotify/fanotify_user.c

index 8fca5ec442e421b9e2855e2fd5f40ff614f9d625..456cc3e92c8832763eaee5c92870498f07612bca 100644 (file)
@@ -117,7 +117,7 @@ struct kmem_cache *fanotify_perm_event_cachep __ro_after_init;
 #define FANOTIFY_EVENT_ALIGN 4
 #define FANOTIFY_FID_INFO_HDR_LEN \
        (sizeof(struct fanotify_event_info_fid) + sizeof(struct file_handle))
-#define FANOTIFY_PIDFD_INFO_HDR_LEN \
+#define FANOTIFY_PIDFD_INFO_LEN \
        sizeof(struct fanotify_event_info_pidfd)
 #define FANOTIFY_ERROR_INFO_LEN \
        (sizeof(struct fanotify_event_info_error))
@@ -172,14 +172,14 @@ static size_t fanotify_event_len(unsigned int info_mode,
                dot_len = 1;
        }
 
-       if (info_mode & FAN_REPORT_PIDFD)
-               event_len += FANOTIFY_PIDFD_INFO_HDR_LEN;
-
        if (fanotify_event_has_object_fh(event)) {
                fh_len = fanotify_event_object_fh_len(event);
                event_len += fanotify_fid_info_len(fh_len, dot_len);
        }
 
+       if (info_mode & FAN_REPORT_PIDFD)
+               event_len += FANOTIFY_PIDFD_INFO_LEN;
+
        return event_len;
 }
 
@@ -501,7 +501,7 @@ static int copy_pidfd_info_to_user(int pidfd,
                                   size_t count)
 {
        struct fanotify_event_info_pidfd info = { };
-       size_t info_len = FANOTIFY_PIDFD_INFO_HDR_LEN;
+       size_t info_len = FANOTIFY_PIDFD_INFO_LEN;
 
        if (WARN_ON_ONCE(info_len > count))
                return -EFAULT;