inotify: Use memcmp() to compare embedded file names

Otherwise gcc warns that strcmp() will read a byte from a zero-length
array, though in practice we exclude that case with an explicit length
check.

Fixes:	f1f230439f ("vfs: Initial revision of inotify")
This commit is contained in:
Mark Johnston committed 2025-07-07 20:16:31 +00:00
1 parent 4ea7a920de
commit bc6b526e2b
1 file changed
+1 -1
+1 -1
View File
@@ -503,7 +503,7 @@ inotify_can_coalesce(struct inotify_softc *sc, struct inotify_event *evp)
return (prev != NULL && prev->ev.mask == evp->mask &&
prev->ev.wd == evp->wd && prev->ev.cookie == evp->cookie &&
prev->ev.len == evp->len &&
(evp->len == 0 || strcmp(prev->ev.name, evp->name) == 0));
memcmp(prev->ev.name, evp->name, evp->len) == 0);
}
static void