diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index aece5dd0e7a8..90c6a4813a19 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -1503,16 +1503,15 @@ next_slot: goto out_check; nocow = true; } else if (extent_type == BTRFS_FILE_EXTENT_INLINE) { - extent_end = found_key.offset + - btrfs_file_extent_ram_bytes(leaf, fi); - extent_end = ALIGN(extent_end, - fs_info->sectorsize); + extent_end = found_key.offset + ram_bytes; + extent_end = ALIGN(extent_end, fs_info->sectorsize); /* Skip extents outside of our requested range */ if (extent_end <= start) { path->slots[0]++; goto next_slot; } } else { + /* If this triggers then we have a memory corruption */ BUG(); } out_check: