From: Nikita Kiryushin Date: Thu, 14 Mar 2024 13:36:56 +0000 (+0300) Subject: fanotify: remove unneeded sub-zero check for unsigned value X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=e6595224464b692ddae193d783402130d1625147;p=linux.git fanotify: remove unneeded sub-zero check for unsigned value Unsigned size_t len in copy_fid_info_to_user is checked for negative value. This check is redundant as it is always false. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: 5e469c830fdb ("fanotify: copy event fid info to user") Signed-off-by: Nikita Kiryushin Signed-off-by: Jan Kara Message-Id: --- diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c index fbdc63cc10d92..4201723357cfb 100644 --- a/fs/notify/fanotify/fanotify_user.c +++ b/fs/notify/fanotify/fanotify_user.c @@ -502,7 +502,7 @@ static int copy_fid_info_to_user(__kernel_fsid_t *fsid, struct fanotify_fh *fh, } /* Pad with 0's */ - WARN_ON_ONCE(len < 0 || len >= FANOTIFY_EVENT_ALIGN); + WARN_ON_ONCE(len >= FANOTIFY_EVENT_ALIGN); if (len > 0 && clear_user(buf, len)) return -EFAULT;