From 672d42b284d4b63661a5e49685c1c1c630bca19f Mon Sep 17 00:00:00 2001 From: Tomasz Zawadzki Date: Tue, 9 Jul 2019 07:44:58 -0400 Subject: [PATCH] lib/blob: fix check against lba during blob load md_start and md_len are values in pages rather than lba. Those should not be compared against lba of currently loaded md page. This patch changes assert to verify if the lba of current page does not exceed max lba where md is expected to be. Signed-off-by: Tomasz Zawadzki Change-Id: Id445eb9871f82f7fe367bfc396f1b495591511c1 Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/460976 Tested-by: SPDK CI Jenkins Reviewed-by: Ben Walker Reviewed-by: Darek Stojaczyk --- lib/blob/blobstore.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/blob/blobstore.c b/lib/blob/blobstore.c index 394654e68..08ac7027f 100644 --- a/lib/blob/blobstore.c +++ b/lib/blob/blobstore.c @@ -975,9 +975,9 @@ _spdk_blob_load_cpl(spdk_bs_sequence_t *seq, void *cb_arg, int bserrno) if (page->next != SPDK_INVALID_MD_PAGE) { uint32_t next_page = page->next; uint64_t next_lba = _spdk_bs_page_to_lba(blob->bs, blob->bs->md_start + next_page); + uint64_t max_md_lba = _spdk_bs_page_to_lba(blob->bs, blob->bs->md_start + blob->bs->md_len); - - assert(next_lba < (blob->bs->md_start + blob->bs->md_len)); + assert(next_lba < max_md_lba); /* Read the next page */ ctx->num_pages++;