[Ocfs2-devel] [bug report] ocfs2: fix a static checker warning

Dan Carpenter dan.carpenter at oracle.com
Tue Sep 25 05:53:47 PDT 2018


Sorry, Gang He,

The error message is still there.

The patch 8c4d5a438716: "ocfs2: fix a static checker warning" from
Jul 6, 2017, leads to the following static checker warning:

	fs/ocfs2/export.c:127 ocfs2_get_dentry()
	warn: 'inode' can also be NULL

fs/ocfs2/inode.c
   161          args.fi_sysfile_type = sysfile_type;
   162  
   163          inode = iget5_locked(sb, args.fi_ino, ocfs2_find_actor,
   164                               ocfs2_init_locked_inode, &args);
   165          /* inode was *not* in the inode cache. 2.6.x requires
   166           * us to do our own read_inode call and unlock it
   167           * afterwards. */
   168          if (inode == NULL) {
   169                  inode = ERR_PTR(-ENOMEM);
   170                  mlog_errno(PTR_ERR(inode));
   171                  goto bail;
   172          }
   173          trace_ocfs2_iget5_locked(inode->i_state);
   174          if (inode->i_state & I_NEW) {
   175                  rc = ocfs2_read_locked_inode(inode, &args);
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Imagine this succeeds.

   176                  unlock_new_inode(inode);
   177          }
   178          if (is_bad_inode(inode)) {
   179                  iput(inode);
   180                  inode = ERR_PTR(rc);
                        ^^^^^^^^^^^^^^^^^^^
We're returning ERR_PTR(0) which is NULL which leads to a NULL
dereference in the caller.

   181                  goto bail;
   182          }
   183  

regards,
dan carpenter



More information about the Ocfs2-devel mailing list