From 7ebba9fcb121e844369f5bf8d1fc6b0ec0847654 Mon Sep 17 00:00:00 2001 From: Ilya Dryomov Date: Tue, 11 Jun 2024 16:03:22 +0200 Subject: [PATCH] librbd: assert on m_length in calc_object_diff_range() A non-empty byte range is required by both last_period_off calculation and Striper::file_to_extents(). Signed-off-by: Ilya Dryomov (cherry picked from commit 6b5f0088d799a72a840fae685b44b0f31eee6be8) --- src/librbd/api/DiffIterate.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/src/librbd/api/DiffIterate.cc b/src/librbd/api/DiffIterate.cc index 717110bd38a..9b400debd13 100644 --- a/src/librbd/api/DiffIterate.cc +++ b/src/librbd/api/DiffIterate.cc @@ -266,6 +266,7 @@ int DiffIterate::diff_iterate(I *ictx, template std::pair DiffIterate::calc_object_diff_range() { + ceph_assert(m_length > 0); uint64_t period = m_image_ctx.get_stripe_period(); uint64_t first_period_off = round_down_to(m_offset, period); uint64_t last_period_off = round_down_to(m_offset + m_length - 1, period); -- 2.39.5