[PATCH 4/6] btrfs-progs: check result of first_cache_extent

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If the tree's empty, we'll get NULL and dereference it.

Resolves-Coverity-CID: 1248828
Signed-off-by: David Sterba <dsterba@xxxxxxx>
---
 cmds-check.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/cmds-check.c b/cmds-check.c
index 6eea36c2f52c..3e7a4ebdce44 100644
--- a/cmds-check.c
+++ b/cmds-check.c
@@ -8075,6 +8075,8 @@ static void free_roots_info_cache(void)
 		struct root_item_info *rii;
 
 		entry = first_cache_extent(roots_info_cache);
+		if (!entry)
+			break;
 		remove_cache_extent(roots_info_cache, entry);
 		rii = container_of(entry, struct root_item_info, cache_extent);
 		free(rii);
-- 
2.1.3

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux