Skip to content
Commit 3e2426bd authored by Eric Sandeen's avatar Eric Sandeen Committed by Chris Mason
Browse files

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: default avatarEric Sandeen <sandeen@redhat.com>

Signed-off-by: default avatarChris Mason <clm@fb.com>
parent d7372780
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment