From 40ca1d513d97c71aad79953bbc3bb56ddea7adc5 Mon Sep 17 00:00:00 2001 From: David Sterba Date: Tue, 6 Sep 2016 13:08:29 +0200 Subject: [PATCH] btrfs-progs: check: improved error handling in calc_extent_flag All callers handle errors. Signed-off-by: David Sterba --- cmds-check.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmds-check.c b/cmds-check.c index df97d3b..aff3c03 100644 --- a/cmds-check.c +++ b/cmds-check.c @@ -6047,7 +6047,9 @@ static int calc_extent_flag(struct btrfs_root *root, cache = lookup_cache_extent(extent_cache, buf->start, 1); /* we have added this extent before */ - BUG_ON(!cache); + if (!cache) + return -ENOENT; + rec = container_of(cache, struct extent_record, cache); /* -- 2.7.4