ocfs2-devel.oss.oracle.com archive mirror
 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 sparse file & data ordering issue in direct io
Date: Thu, 7 Jul 2016 18:35:39 +0300	[thread overview]
Message-ID: <20160707153539.GA19602@mwanda> (raw)

Hello Ryan Ding,

The patch c15471f79506: "ocfs2: fix sparse file & data ordering issue
in direct io" from Mar 25, 2016, leads to the following static
checker warning:

	fs/ocfs2/aops.c:2205 ocfs2_dio_get_block()
	error: potentially dereferencing uninitialized 'wc'.

fs/ocfs2/aops.c
  2196  
  2197          ret = ocfs2_write_begin_nolock(inode->i_mapping, pos, len,
  2198                                         OCFS2_WRITE_DIRECT, NULL,
  2199                                         (void **)&wc, di_bh, NULL);
  2200          if (ret) {
  2201                  mlog_errno(ret);
  2202                  goto unlock;
  2203          }
  2204  
  2205          desc = &wc->w_desc[0];
  2206  
  2207          p_blkno = ocfs2_clusters_to_blocks(inode->i_sb, desc->c_phys);
  2208          BUG_ON(p_blkno == 0);
  2209          p_blkno += iblock & (u64)(ocfs2_clusters_to_blocks(inode->i_sb, 1) - 1);

What it's complaining about is this code path:

fs/ocfs2/aops.c
  1807  
  1808          /*
  1809           * ocfs2_grab_pages_for_write() returns -EAGAIN if it could not lock
  1810           * the target page. In this case, we exit with no error and no target
  1811           * page. This will trigger the caller, page_mkwrite(), to re-try
  1812           * the operation.
  1813           */
  1814          if (ret == -EAGAIN) {
  1815                  BUG_ON(wc->w_target_page);
  1816                  ret = 0;
  1817                  goto out_quota;
  1818          }
  1819  

We return success without setting "wc".  It says that the caller will
check the target page, but we are passing a NULL target page?  It's not
clear to me how this works.

regards,
dan carpenter

                 reply	other threads:[~2016-07-07 15:35 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20160707153539.GA19602@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 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).