kernfs: simplify kernfs_name_hash()

In 'kernfs_name_hash()', 'name' is NUL-terminated so it may be
directly scanned up to end without an extra call to 'strlen()'.

Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
Link: https://patch.msgid.link/20260617073941.472337-1-dmantipov@yandex.ru
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Dmitry Antipov
2026-06-17 10:39:41 +03:00
committed by Danilo Krummrich
parent 32e21e9509
commit d996995a0f

View File

@@ -330,8 +330,8 @@ static unsigned int kernfs_name_hash(const char *name,
const struct ns_common *ns)
{
unsigned long hash = init_name_hash(kernfs_ns_id(ns));
unsigned int len = strlen(name);
while (len--)
while (*name)
hash = partial_name_hash(*name++, hash);
hash = end_name_hash(hash);
hash &= 0x7fffffffU;