Skip to content

Commit e0ab7af

Browse files
George Spelvintorvalds
George Spelvin
authored andcommitted
hash_string: Fix zero-length case for !DCACHE_WORD_ACCESS
The self-test was updated to cover zero-length strings; the function needs to be updated, too. Reported-by: Geert Uytterhoeven <[email protected]> Signed-off-by: George Spelvin <[email protected]> Fixes: fcfd2fb ("fs/namei.c: Add hashlen_string() function") Signed-off-by: Linus Torvalds <[email protected]>
1 parent f2a031b commit e0ab7af

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

fs/namei.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -1968,11 +1968,11 @@ u64 hashlen_string(const char *name)
19681968
unsigned long len = 0, c;
19691969

19701970
c = (unsigned char)*name;
1971-
do {
1971+
while (c) {
19721972
len++;
19731973
hash = partial_name_hash(c, hash);
19741974
c = (unsigned char)name[len];
1975-
} while (c);
1975+
}
19761976
return hashlen_create(end_name_hash(hash), len);
19771977
}
19781978
EXPORT_SYMBOL(hashlen_string);

0 commit comments

Comments
 (0)