From: Gao Xiang <hsiang...@aol.com> In case that new buffer allocation optimization logic is potentially broken.
Signed-off-by: Gao Xiang <hsiang...@aol.com> --- lib/cache.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/cache.c b/lib/cache.c index e8840ac5dd31..c4851168ede7 100644 --- a/lib/cache.c +++ b/lib/cache.c @@ -186,8 +186,13 @@ static int erofs_bfind_for_attach(int type, erofs_off_t size, mapped_list); /* last mapped block can be expended, don't handle it here */ - if (cur == last_mapped_block) + if (list_next_entry(cur, list)->blkaddr == NULL_ADDR) { + DBG_BUGON(cur != last_mapped_block); continue; + } + + DBG_BUGON(cur->type != type); + DBG_BUGON(cur->blkaddr == NULL_ADDR); ret = __erofs_battach(cur, NULL, size, alignsize, required_ext + inline_ext, true); -- 2.24.0