[PATCH] fs/namei.c. If we way we want zero-length string suppor mean it.
From: George Spelvin
Date: Sun May 29 2016 - 08:05:56 EST
hash_name() is not changed for speed, but the more general
purpose hashlen_string need to support zero-length strings.
Signed-off-by: George Spelvin <linux@xxxxxxxxxxxxxxxxxxx>
Fixes: fcfd2fbf22d2587196890103d41e3d554c47da0e
---
Just kill me. I didn't re-test the side of the code that I "didn't touch",
but at Bruce Field's (correct!) prompting, I changed the test to cover
a corner case it hadn't addressed.
fs/namei.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/namei.c b/fs/namei.c
index aefba699..dcb85255 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1958,11 +1958,11 @@ u64 hashlen_string(const char *name)
unsigned long len = 0, c;
c = (unsigned char)*name;
- do {
+ while (c) {
len++;
hash = partial_name_hash(c, hash);
c = (unsigned char)name[len];
- } while (c);
+ }
return hashlen_create(end_name_hash(hash), len);
}
EXPORT_SYMBOL(hashlen_string);
--
2.8.1