btrfs-progs/convert
Thomas Hebb 407a8721b6 btrfs-progs: convert: fix off-by-one error in overlap test
intersect_with_reserved() currently succeeds if (bytenr + num_bytes) is
greater than or equal to the first address in the range, assuming that
bytenr is also not past the end of the range.

This is wrong. (bytenr + num bytes) is one byte past the last address in
the range we're checking, meaning that our range only overlaps the
reserved range if it's strictly greater than the reserved range's start
address.

For example, imagine a range at 0x3000 with length 0x1000 that we're
checking against a reserved range that starts at 0x4000. The addresses
in our range are 0x3000-0x3fff: it doesn't overlap. But the current
check, (0x3000 + 0x1000 >= 0x4000), will erroneously pass.

Fix the issue by changing >= to >.

Issue: #297
Issue: #349
Author: Thomas Hebb <tommyhebb@gmail.com>
Pull-request: #494
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2022-10-11 09:08:08 +02:00
..
common.c btrfs-progs: convert: update include lists 2022-10-11 09:06:12 +02:00
common.h btrfs-progs: convert: move simple_range into common.h 2022-10-11 09:08:08 +02:00
main.c btrfs-progs: convert: make comment formatting consistent 2022-10-11 09:08:08 +02:00
Makefile btrfs-progs: build: add stub makefile to convert 2017-03-08 13:00:46 +01:00
source-ext2.c btrfs-progs: convert: use message helpers for error messages 2022-10-11 09:08:07 +02:00
source-ext2.h btrfs-progs: convert: update include lists 2022-10-11 09:06:12 +02:00
source-fs.c btrfs-progs: convert: fix off-by-one error in overlap test 2022-10-11 09:08:08 +02:00
source-fs.h btrfs-progs: convert: move simple_range into common.h 2022-10-11 09:08:08 +02:00
source-reiserfs.c btrfs-progs: convert: use message helpers for error messages 2022-10-11 09:08:07 +02:00
source-reiserfs.h btrfs-progs: convert: update include lists 2022-10-11 09:06:12 +02:00