Skip to contentSkip to conversation

f2fs: signedness bug in f2fs_fname_setup_ci_filename()

PATCH In review Dan Carpenter 2 participants 3 messages Sep 4, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 f2fs: signedness bug in f2fs_fname_setup_ci_filename()

The error handling doesn't work because "cf_name->len" is unsigned.

Fixes fbce5d4ab3ab ("f2fs: optimize case-insensitive lookups")
---
 fs/f2fs/dir.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/dir.c +1 -1
index 9de688a4e115..c83b666f9d7e 100644
@@ -157,7 +157,7 @@ void f2fs_fname_setup_ci_filename(struct inode *dir,
 	cf_name->len = utf8_casefold(sbi->s_encoding,
 					iname, cf_name->name,
 					F2FS_NAME_LEN);
-	if (cf_name->len <= 0) {
+	if ((int)cf_name->len <= 0) {
 		kvfree(cf_name->name);
 		cf_name->name = NULL;
 	}
Signature · 1 line
2.20.1
#1 lore raw
Quoted 1 line · Dan Carpenter

The error handling doesn't work because "cf_name->len" is unsigned.

Dan, thanks for catching this, would you mind merging this into original patch, since it's still in the dev branch. :)

Thanks,

Quoted 21 lines
Fixes fbce5d4ab3ab ("f2fs: optimize case-insensitive lookups")
---
 fs/f2fs/dir.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/dir.c +1 -1
index 9de688a4e115..c83b666f9d7e 100644
@@ -157,7 +157,7 @@ void f2fs_fname_setup_ci_filename(struct inode *dir,
 	cf_name->len = utf8_casefold(sbi->s_encoding,
 					iname, cf_name->name,
 					F2FS_NAME_LEN);
-	if (cf_name->len <= 0) {
+	if ((int)cf_name->len <= 0) {
 		kvfree(cf_name->name);
 		cf_name->name = NULL;
 	}
#2 lore raw
Quoted 5 lines · Chao Yu
Quoted 1 line · Dan Carpenter

The error handling doesn't work because "cf_name->len" is unsigned.

Dan, thanks for catching this, would you mind merging this into original patch, since it's still in the dev branch. :)

I don't mind if you fold it into the original. That's fine.

regards,
dan carpenter