Re: [PATCH 3/3] xfs: optimize bio handling in the buffer writeback path

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxx
http://oss.sgi.com/mailman/listinfo/xfs



[Index of Archives]     [Linux XFS Devel]     [Linux Filesystem Development]     [Filesystem Testing]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux