linux-erofs.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] erofs-utils: check the return value of erofs_d_alloc
@ 2021-11-17 10:21 Huang Jianan via Linux-erofs
  2021-11-17 10:21 ` [PATCH] erofs-utils: fix memory leak when get blob chunk Huang Jianan via Linux-erofs
  2021-11-18 10:04 ` [PATCH] erofs-utils: check the return value of erofs_d_alloc Yue Hu
  0 siblings, 2 replies; 3+ messages in thread
From: Huang Jianan via Linux-erofs @ 2021-11-17 10:21 UTC (permalink / raw)
  To: linux-erofs, xiang; +Cc: yh, guoweichao, zhangshiming, guanyuwei

Need to check whether the allocation of erofs_dentry is successful.

Signed-off-by: Huang Jianan <huangjianan@oppo.com>
---
 lib/inode.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/inode.c b/lib/inode.c
index 5cbfc78..2fa74e2 100644
--- a/lib/inode.c
+++ b/lib/inode.c
@@ -162,11 +162,15 @@ int erofs_prepare_dir_file(struct erofs_inode *dir, unsigned int nr_subdirs)
 
 	/* dot is pointed to the current dir inode */
 	d = erofs_d_alloc(dir, ".");
+	if (IS_ERR(d))
+		return PTR_ERR(d);
 	d->inode = erofs_igrab(dir);
 	d->type = EROFS_FT_DIR;
 
 	/* dotdot is pointed to the parent dir */
 	d = erofs_d_alloc(dir, "..");
+	if (IS_ERR(d))
+		return PTR_ERR(d);
 	d->inode = erofs_igrab(dir->i_parent);
 	d->type = EROFS_FT_DIR;
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-11-18 10:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-17 10:21 [PATCH] erofs-utils: check the return value of erofs_d_alloc Huang Jianan via Linux-erofs
2021-11-17 10:21 ` [PATCH] erofs-utils: fix memory leak when get blob chunk Huang Jianan via Linux-erofs
2021-11-18 10:04 ` [PATCH] erofs-utils: check the return value of erofs_d_alloc Yue Hu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).