If we get a zero-length from the ioctl for whatever reason, we should
not crash.
Signed-off-by: David Sterba <dsterba@suse.com>
{
struct shared_extent *sh;
{
struct shared_extent *sh;
sh = calloc(1, sizeof(*sh));
if (!sh)
sh = calloc(1, sizeof(*sh));
if (!sh)
if (flags & SKIP_FLAGS)
continue;
if (flags & SKIP_FLAGS)
continue;
+ if (ext_len == 0) {
+ warning("extent %llu has length 0, skipping",
+ (unsigned long long)fm_ext[i].fe_physical);
+ continue;
+ }
+
file_total += ext_len;
if (flags & FIEMAP_EXTENT_SHARED) {
file_shared += ext_len;
file_total += ext_len;
if (flags & FIEMAP_EXTENT_SHARED) {
file_shared += ext_len;