[07/10] ubifs: do not ubifs_inode() on potentially NULL pointer
diff mbox series

Message ID 20191030152702.14269-8-s.hauer@pengutronix.de
State New
Headers show
  • Add quota support to UBIFS
Related show

Commit Message

Sascha Hauer Oct. 30, 2019, 3:26 p.m. UTC
new_inode() may return NULL, so only derefence the return inode when
non NULL. This is merely a cleanup as calling ubifs_inode() on a NULL
pointer doesn't do any harm, only using the return value would.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
 fs/ubifs/dir.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff mbox series

diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c
index 0b98e3c8b461..cfce5fee9262 100644
--- a/fs/ubifs/dir.c
+++ b/fs/ubifs/dir.c
@@ -95,10 +95,10 @@  struct inode *ubifs_new_inode(struct ubifs_info *c, struct inode *dir,
 	inode = new_inode(c->vfs_sb);
-	ui = ubifs_inode(inode);
 	if (!inode)
 		return ERR_PTR(-ENOMEM);
+	ui = ubifs_inode(inode);
 	 * Set 'S_NOCMTIME' to prevent VFS form updating [mc]time of inodes and
 	 * marking them dirty in file write path (see 'file_update_time()').