[PATCH 09/11] xfsprogs: xfs_repair: fix possible null dereference in traverse_int_dir2block

Vivek Trivedi t.vivek at samsung.com
Wed Dec 2 05:19:25 CST 2015


Fix possible null dereference in traverse_int_dir2block if buffer pointer is NULL.
Reported by coverity.

Signed-off-by: Vivek Trivedi <t.vivek at samsung.com>
---
 repair/dir2.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/repair/dir2.c b/repair/dir2.c
index 61912d1..fe360dc 100644
--- a/repair/dir2.c
+++ b/repair/dir2.c
@@ -1300,7 +1300,7 @@ _("block %" PRIu64 " for directory inode %" PRIu64 " is missing\n"),
 		bp = da_read_buf(mp, nex, bmp, &xfs_dir3_data_buf_ops);
 		if (bmp != &lbmp)
 			free(bmp);
-		if (bp == NULL) {
+		if (bp == NULL || !bp->b_addr) {
 			do_warn(
 _("can't read block %" PRIu64 " for directory inode %" PRIu64 "\n"),
 				dbno, ino);
-- 
1.7.9.5



More information about the xfs mailing list