Whamcloud - gitweb
hashmap: change return value type of ext2fs_hashmap_add()
authorZhiqiang Liu <liuzhiqiang26@huawei.com>
Wed, 28 Jul 2021 01:56:47 +0000 (09:56 +0800)
committerTheodore Ts'o <tytso@mit.edu>
Tue, 3 Aug 2021 02:25:18 +0000 (22:25 -0400)
commit212827d1909d66f57bb76524c18c113d6bc71909
tree4f632816215bf4709e01fc143809e52020fc4ae6
parenteccdde1ff381591cae935ddd5444ac9445c94fc3
hashmap: change return value type of ext2fs_hashmap_add()

In ext2fs_hashmap_add(), new entry is allocated by calling
malloc(). If malloc() return NULL, it will cause a
segmentation fault problem.

Here, we change return value type of ext2fs_hashmap_add()
from void to int. If allocating new entry fails, we will
return -1, and the callers should also verify the return
value of ext2fs_hashmap_add().

Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
Signed-off-by: Wu Guanghao <wuguanghao3@huawei.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
contrib/android/base_fs.c
lib/ext2fs/fileio.c
lib/ext2fs/hashmap.c
lib/ext2fs/hashmap.h