Commit 463626a2 authored by David Sterba's avatar David Sterba
Browse files

btrfs: use common eb range validation in read_extent_buffer_to_user_nofault()



The extent buffer access is checked in other helpers by
check_eb_range(), which validates the requested start, length against
the extent buffer. While this almost never fails we should still handle
it as an error and not just warn.

Reviewed-by: default avatarBoris Burkov <boris@bur.io>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent b8aa3371
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -4061,8 +4061,8 @@ int read_extent_buffer_to_user_nofault(const struct extent_buffer *eb,
	unsigned long i;
	int ret = 0;

	WARN_ON(start > eb->len);
	WARN_ON(start + len > eb->start + eb->len);
	if (check_eb_range(eb, start, len))
		return -EINVAL;

	if (eb->addr) {
		if (copy_to_user_nofault(dstv, eb->addr + start, len))