[PATCH 06/11] xfsprogs: xfs_db: check null derefernce after block_to_bt
Vivek Trivedi
t.vivek at samsung.com
Wed Dec 2 05:19:22 CST 2015
add assert if block_to_bt returns NULL to avoid null pointer
dereference and get backtrace.
Reported by coverity.
Signed-off-by: Vivek Trivedi <t.vivek at samsung.com>
---
db/btblock.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/db/btblock.c b/db/btblock.c
index 46140fc..91593f8 100644
--- a/db/btblock.c
+++ b/db/btblock.c
@@ -180,6 +180,7 @@ btblock_key_offset(
struct xfs_db_btree *bt = block_to_bt(block);
int offset;
+ ASSERT(bt != NULL);
ASSERT(startoff == 0);
ASSERT(block->bb_level != 0);
@@ -201,6 +202,7 @@ btblock_ptr_offset(
int offset;
int maxrecs;
+ ASSERT(bt != NULL);
ASSERT(startoff == 0);
ASSERT(block->bb_level != 0);
@@ -225,6 +227,7 @@ btblock_rec_offset(
struct xfs_db_btree *bt = block_to_bt(block);
int offset;
+ ASSERT(bt != NULL);
ASSERT(startoff == 0);
ASSERT(block->bb_level == 0);
--
1.7.9.5
More information about the xfs
mailing list