[snip] >> - if (dst_offset + len > dst->len) { >> - btrfs_err(fs_info, >> - "memmove bogus dst_offset %lu move len %lu dst len %lu", >> - dst_offset, len, dst->len); >> - BUG(); >> - } >> + if (check_eb_range(dst, dst_offset, len) || >> + check_eb_range(dst, src_offset, len)) >> + return; > > I'm not sure about this. If the code expects memcpy_extent_buffer to > never fail then it will make more sense to do the range check outside of > this function. Otherwise it might silently fail and cause mayhem up the > call chain. Or just leave the BUG (I'd rather not).
Yes, that's also what I'm concerned. But at least, for that case we're not making things worse. Furthermore, btrfs tree checker should have already rejected most invalid trees already. So I'm not so concerned. Thanks, Qu