summary refs log tree commit diff
path: root/fs/f2fs/hash.c
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk@kernel.org>2014-08-29 00:26:50 -0700
committerJaegeuk Kim <jaegeuk@kernel.org>2014-08-29 00:26:50 -0700
commit3304b56401c4509ffaa74705b49edc9e13cee195 (patch)
tree8c4d271e0ee6fe5de467e7584beac3a9e445d205 /fs/f2fs/hash.c
parent922cedbd00b68e506eb6f37cbe07cdf399a37b27 (diff)
downloadlinux-3304b56401c4509ffaa74705b49edc9e13cee195.tar.gz
f2fs: fix wrong casting for dentry name
The dentry name type is unsigned char *.
If we don't match this type, some character codes can be changed by signed bit.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/hash.c')
-rw-r--r--fs/f2fs/hash.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/fs/f2fs/hash.c b/fs/f2fs/hash.c
index 948d17bf7281..a844fcfb9a8d 100644
--- a/fs/f2fs/hash.c
+++ b/fs/f2fs/hash.c
@@ -42,7 +42,8 @@ static void TEA_transform(unsigned int buf[4], unsigned int const in[])
 	buf[1] += b1;
 }
 
-static void str2hashbuf(const char *msg, size_t len, unsigned int *buf, int num)
+static void str2hashbuf(const unsigned char *msg, size_t len,
+				unsigned int *buf, int num)
 {
 	unsigned pad, val;
 	int i;
@@ -73,9 +74,9 @@ f2fs_hash_t f2fs_dentry_hash(const struct qstr *name_info)
 {
 	__u32 hash;
 	f2fs_hash_t f2fs_hash;
-	const char *p;
+	const unsigned char *p;
 	__u32 in[8], buf[4];
-	const char *name = name_info->name;
+	const unsigned char *name = name_info->name;
 	size_t len = name_info->len;
 
 	if ((len <= 2) && (name[0] == '.') &&