f2fs: signedness bug in f2fs_fname_setup_ci_filename()
Subsystems (2)
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")
Signed-off-by Dan Carpenter <[email protected]>
--- fs/f2fs/dir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/dir.c +1 -1
@@ -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
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")Signed-off-by Dan Carpenter <[email protected]>--- fs/f2fs/dir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/f2fs/dir.c +1
-1@@ -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 ; }
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