diff --git a/src/test/util_badblock/util_badblock.c b/src/test/util_badblock/util_badblock.c
index c047fa75bff933948016578e03ffb2424f834476..af712f8d2b40b583bb6027c9a36bd672285da46f 100644
--- a/src/test/util_badblock/util_badblock.c
+++ b/src/test/util_badblock/util_badblock.c
@@ -42,6 +42,7 @@
 #include "os_dimm.h"
 #include "os_badblock.h"
 #include "badblock.h"
+#include "file.h"
 
 #define MIN_POOL ((size_t)(1024 * 1024 * 8)) /* 8 MiB */
 #define MIN_PART ((size_t)(1024 * 1024 * 2)) /* 2 MiB */
@@ -71,6 +72,10 @@ do_list(const char *path)
 		goto exit_free;
 	}
 
+	int file_type = util_file_get_type(path);
+	if (file_type < 0)
+		UT_FATAL("!Cannot read type of the file");
+
 	UT_OUT("Found %u bad block(s):", bbs->bb_cnt);
 
 	unsigned b;
@@ -78,8 +83,14 @@ do_list(const char *path)
 		UT_OUT("%llu %u",
 			/* offset is printed in 512b sectors  */
 			bbs->bbv[b].offset >> 9,
-			/* length is printed in blocks */
-			bbs->bbv[b].length / (unsigned)st.st_blksize);
+			/*
+			 * length is printed in:
+			 * - 512b sectors in case of DAX devices,
+			 * - blocks in case of regular files.
+			 */
+			(file_type == TYPE_DEVDAX) ?
+				bbs->bbv[b].length >> 9 :
+				bbs->bbv[b].length / (unsigned)st.st_blksize);
 	}
 
 exit_free: