53 lines
1.4 KiB
Diff
53 lines
1.4 KiB
Diff
|
|
From 4d19f9bec7997e90b36422c6779ec1d98def95f3 Mon Sep 17 00:00:00 2001
|
||
|
|
From: biubiuzy <294772273@qq.com>
|
||
|
|
Date: Wed, 17 Jan 2024 11:23:47 +0800
|
||
|
|
Subject: [PATCH] libblkid: (drbd) reduce false-positive
|
||
|
|
|
||
|
|
Reference:https://github.com/util-linux/util-linux/commit/4d19f9bec7997e90b36422c6779ec1d98def95f3
|
||
|
|
Conflict:Context adapt
|
||
|
|
---
|
||
|
|
libblkid/src/superblocks/drbd.c | 13 +++++++++++++
|
||
|
|
1 file changed, 13 insertions(+)
|
||
|
|
|
||
|
|
diff --git a/libblkid/src/superblocks/drbd.c b/libblkid/src/superblocks/drbd.c
|
||
|
|
index 1723229..410e21d 100644
|
||
|
|
--- a/libblkid/src/superblocks/drbd.c
|
||
|
|
+++ b/libblkid/src/superblocks/drbd.c
|
||
|
|
@@ -18,6 +18,13 @@
|
||
|
|
|
||
|
|
#include "superblocks.h"
|
||
|
|
|
||
|
|
+/*
|
||
|
|
+ * drbd/drbd_int.h
|
||
|
|
+ */
|
||
|
|
+#define BM_BLOCK_SHIFT 12 /* 4k per bit */
|
||
|
|
+#define BM_BLOCK_SIZE (1<<BM_BLOCK_SHIFT)
|
||
|
|
+
|
||
|
|
+
|
||
|
|
/*
|
||
|
|
* drbd/linux/drbd.h
|
||
|
|
*/
|
||
|
|
@@ -153,6 +160,9 @@ static int probe_drbd_84(blkid_probe pr)
|
||
|
|
be32_to_cpu(md->magic) != DRBD_MD_MAGIC_84_UNCLEAN)
|
||
|
|
return 1;
|
||
|
|
|
||
|
|
+ if (be32_to_cpu(read_unaligned_member(md, bm_bytes_per_bit)) != BM_BLOCK_SIZE)
|
||
|
|
+ return 1;
|
||
|
|
+
|
||
|
|
if (!is_zero_padded(member_ptr(md, padding_start),
|
||
|
|
member_ptr(md, padding_end)))
|
||
|
|
return 1;
|
||
|
|
@@ -201,6 +211,9 @@ static int probe_drbd_90(blkid_probe pr)
|
||
|
|
if (be32_to_cpu(md->magic) != DRBD_MD_MAGIC_09)
|
||
|
|
return 1;
|
||
|
|
|
||
|
|
+ if (be32_to_cpu(read_unaligned_member(md, bm_bytes_per_bit)) != BM_BLOCK_SIZE)
|
||
|
|
+ return 1;
|
||
|
|
+
|
||
|
|
if (!is_zero_padded(member_ptr(md, padding_start),
|
||
|
|
member_ptr(md, padding_end)))
|
||
|
|
return 1;
|
||
|
|
--
|
||
|
|
2.33.0
|
||
|
|
|