linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/1] lightnvm: pblk: Import GUID before use
@ 2021-04-15 14:22 Andy Shevchenko
  0 siblings, 0 replies; only message in thread
From: Andy Shevchenko @ 2021-04-15 14:22 UTC (permalink / raw)
  To: Andy Shevchenko, linux-block, linux-kernel; +Cc: Matias Bjorling

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

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/lightnvm/pblk-recovery.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/lightnvm/pblk-recovery.c b/drivers/lightnvm/pblk-recovery.c
index 0e6f0c76e930..81b1b751d8c4 100644
--- a/drivers/lightnvm/pblk-recovery.c
+++ b/drivers/lightnvm/pblk-recovery.c
@@ -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;
-- 
2.30.2


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-04-15 14:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-15 14:22 [PATCH v1 1/1] lightnvm: pblk: Import GUID before use Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).