f2fs-tools: fix to call assert() if f2fs_dentry_hash() fails
PATCH 1/1 f2fs-tools: fix to call assert() if f2fs_dentry_hash() fails
f2fs_dentry_hash() may return -ENOMEM due to malloc() failure, however caller won't check validaty of return value, result assign or check wrong hash value, fix to call assert() for such case.
Signed-off-by Chao Yu <[email protected]>
--- lib/libf2fs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
lib/libf2fs.c +2 -2
@@ -497,8 +497,8 @@ f2fs_hash_t f2fs_dentry_hash(int encoding, int casefolded,if (len && casefolded) { buff =malloc (sizeof (char ) *PATH_MAX ); -if (!buff) -return -ENOMEM ; +ASSERT (buff); + dlen = table->ops->casefold (table, name, len, buff,PATH_MAX );if (dlen <0 ) {free (buff);
Signature · 8 lines
2.40.1 _______________________________________________ Linux-f2fs-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel