public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Eric Sandeen <sandeen@sandeen.net>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH 3/3] xfs: optimize bio handling in the buffer writeback path
Date: Tue, 31 May 2016 09:31:18 -0700	[thread overview]
Message-ID: <20160531163118.GA7016@infradead.org> (raw)
In-Reply-To: <b8d49db2-131d-0735-c803-adec326f43bb@sandeen.net>

On Tue, May 31, 2016 at 10:35:01AM -0500, Eric Sandeen wrote:
> Coverity thinks this is problematic, calling it a
> "Free of address-of expression (BAD_FREE)"
> 
> CID 1362192
> 
> The issue is that if bio still == io_inline_bio, we are freeing
> memory which was not allocated.

No, we free the ioend into which the bio is embedded.  Take a look
at the allocation side in xfs_alloc_ioend:

	bio = bio_alloc_bioset(GFP_NOFS, BIO_MAX_PAGES, xfs_ioend_bioset);

	ioend = container_of(bio, struct xfs_ioend, io_inline_bio);


> Maybe this needs a:
> 
> if (bio != &ioend->io_inline_bio)
> 	bio_put(bio);

That would leak every ioend used.

> or is there a better way?

We just need to shut up the checker..

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

  reply	other threads:[~2016-05-31 16:31 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-16 11:44 further writeback updates V2 Christoph Hellwig
2016-03-16 11:44 ` [PATCH 1/3] xfs: build bios directly in xfs_add_to_ioend Christoph Hellwig
2016-03-17 13:05   ` Brian Foster
2016-03-16 11:44 ` [PATCH 2/3] xfs: don't release bios on completion immediately Christoph Hellwig
2016-03-17 13:05   ` Brian Foster
2016-03-16 11:44 ` [PATCH 3/3] xfs: optimize bio handling in the buffer writeback path Christoph Hellwig
2016-03-17 13:05   ` Brian Foster
2016-05-31 15:35   ` Eric Sandeen
2016-05-31 16:31     ` Christoph Hellwig [this message]
2016-05-31 16:44       ` Eric Sandeen
2016-05-31 17:35         ` Eric Sandeen
  -- strict thread matches above, loose matches on Subject: below --
2016-02-24  8:20 futher writeback updates Christoph Hellwig
2016-02-24  8:20 ` [PATCH 3/3] xfs: optimize bio handling in the buffer writeback path Christoph Hellwig
2016-03-03 15:17   ` Brian Foster
2016-03-04 13:38     ` Brian Foster
2016-03-11 15:06       ` Christoph Hellwig
2016-03-11 14:55     ` Christoph Hellwig

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=20160531163118.GA7016@infradead.org \
    --to=hch@infradead.org \
    --cc=sandeen@sandeen.net \
    --cc=xfs@oss.sgi.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