]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: fix use of uninit "ret" in end_extent_writepage()
authorEric Sandeen <sandeen@redhat.com>
Thu, 12 Jun 2014 05:39:58 +0000 (00:39 -0500)
committerChris Mason <clm@fb.com>
Fri, 13 Jun 2014 16:52:28 +0000 (09:52 -0700)
commit7adad130cac479cc05d0691e47707f219c575508
tree4e08fc2ba5d9d174882ca9ad40f43327e701db4c
parent87a04aadde3fac6992036acb18fadeeb2e1a5ce3
btrfs: fix use of uninit "ret" in end_extent_writepage()

If this condition in end_extent_writepage() is false:

if (tree->ops && tree->ops->writepage_end_io_hook)

we will then test an uninitialized "ret" at:

ret = ret < 0 ? ret : -EIO;

The test for ret is for the case where ->writepage_end_io_hook
failed, and we'd choose that ret as the error; but if
there is no ->writepage_end_io_hook, nothing sets ret.

Initializing ret to 0 should be sufficient; if
writepage_end_io_hook wasn't set, (!uptodate) means
non-zero err was passed in, so we choose -EIO in that case.

Signed-of-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Chris Mason <clm@fb.com>
fs/btrfs/extent_io.c