All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [bug report] ocfs2: fix a static checker warning
Date: Tue, 25 Sep 2018 15:53:47 +0300	[thread overview]
Message-ID: <20180925125347.GA1300@mwanda> (raw)

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

             reply	other threads:[~2018-09-25 12:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-25 12:53 Dan Carpenter [this message]
2018-09-25 15:40 ` [Ocfs2-devel] [bug report] ocfs2: fix a static checker warning Gang He

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180925125347.GA1300@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=ocfs2-devel@oss.oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.