Linux XFS filesystem development
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: Sherry Yang <sherry.yang@oracle.com>
Cc: Dave Chinner <david@fromorbit.com>,
	"dchinner@redhat.com" <dchinner@redhat.com>,
	Allison Henderson <allison.henderson@oracle.com>,
	"chandanrlinux@gmail.com" <chandanrlinux@gmail.com>,
	"bfoster@redhat.com" <bfoster@redhat.com>,
	"linux-xfs@vger.kernel.org" <linux-xfs@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v1] xfs: initialize error in xfs_defer_finish_one
Date: Wed, 3 Aug 2022 22:07:34 -0700	[thread overview]
Message-ID: <YutUFo9nB1ubWtb6@magnolia> (raw)
In-Reply-To: <DB9D3780-165D-4E49-823D-4D5253E64905@oracle.com>

On Wed, Aug 03, 2022 at 11:42:21PM +0000, Sherry Yang wrote:
> 
> > On Aug 2, 2022, at 9:31 PM, Darrick J. Wong <djwong@kernel.org> wrote:
> > 
> > On Tue, Aug 02, 2022 at 06:49:02AM +1000, Dave Chinner wrote:
> >> On Mon, Aug 01, 2022 at 12:03:11PM -0700, Sherry Yang wrote:
> >>> Path through non-void function 'xfs_defer_finish_one' may return error
> >>> uninitialized if no iteration of 'list_for_each_safe' occurs. Fix this
> >>> by initializing error.
> >> 
> >> I didn't think this situation was possible - how do we get deferred
> >> work queued with no work items on it?
> >> 
> >> If we can return an uninitialised error from xfs_defer_finish_one()
> >> because of an empty queued work, then something else has gone wrong
> >> earlier in the work deferral process. If this can actually happen,
> >> then we need to fix whatever is creating the empty work rather than
> >> paper over it by initialising the error being returned for empty
> >> works...
> > 
> > /me bets this is a response to a static checker that doesn't know that
> > list_empty(&dfp->dfp_work) == false in all circumstances.  It's not
> > possible for tp->t_dfops to contain an xfs_defer_pending with no work
> > items.
> 
> Hi Darrick, 
> 
> You’re correct. This is a false positive bug detected by our static code 
> analysis tool. Sorry for the noise.

Well, thank /you/ for running smatch/sparse/whatever on the XFS code
base.  Let us know if you find any other oddities, since it does tend to
find things every now and then. :)

--D

> Sherry
> > 
> > --D
> > 
> >> Cheers,
> >> 
> >> Dave.
> >> -- 
> >> Dave Chinner
> >> david@fromorbit.com
> 

      reply	other threads:[~2022-08-04  5:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-01 19:03 [PATCH v1] xfs: initialize error in xfs_defer_finish_one Sherry Yang
2022-08-01 20:49 ` Dave Chinner
2022-08-03  4:31   ` Darrick J. Wong
2022-08-03 23:42     ` Sherry Yang
2022-08-04  5:07       ` Darrick J. Wong [this message]

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=YutUFo9nB1ubWtb6@magnolia \
    --to=djwong@kernel.org \
    --cc=allison.henderson@oracle.com \
    --cc=bfoster@redhat.com \
    --cc=chandanrlinux@gmail.com \
    --cc=david@fromorbit.com \
    --cc=dchinner@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=sherry.yang@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