Skip to contentSkip to conversation

lightnvm: pblk: Import GUID before use

PATCH New Andy Shevchenko 1 participant 1 message Apr 15, 2021 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lightnvm: pblk: Import GUID before use

Strictly speaking the comparison between guid_t and raw buffer is not correct. Import GUID to variable of guid_t type and then compare.

---
 drivers/lightnvm/pblk-recovery.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/lightnvm/pblk-recovery.c +5 -3
index 0e6f0c76e930..81b1b751d8c4 100644
@@ -661,6 +661,7 @@ struct pblk_line *pblk_recov_l2p(struct pblk *pblk)
 	int meta_line;
 	int i, valid_uuid = 0;
 	LIST_HEAD(recov_list);
+	guid_t guid;
 
 	/* TODO: Implement FTL snapshot */
 
@@ -704,14 +705,15 @@ struct pblk_line *pblk_recov_l2p(struct pblk *pblk)
 			return ERR_PTR(-EINVAL);
 		}
 
+		import_guid(&guid, smeta_buf->header.uuid);
+
 		/* The first valid instance uuid is used for initialization */
 		if (!valid_uuid) {
-			import_guid(&pblk->instance_uuid, smeta_buf->header.uuid);
+			guid_copy(&pblk->instance_uuid, &guid);
 			valid_uuid = 1;
 		}
 
-		if (!guid_equal(&pblk->instance_uuid,
-				(guid_t *)&smeta_buf->header.uuid)) {
+		if (!guid_equal(&pblk->instance_uuid, &guid)) {
 			pblk_debug(pblk, "ignore line %u due to uuid mismatch\n",
 					i);
 			continue;
Signature · 1 line
2.30.2