Skip to contentSkip to conversation

nvmet: Don't use uuid_le type

PATCH New Andy Shevchenko 3 participants 5 messages Jul 16, 2018 – Jul 17, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nvmet: Don't use uuid_le type

Don't use sizeof(uuid_le) where none of the parameters is type of uuid_le. Since both arguments are u8 [16], use plain number there.

Moreover, uuid_le is a deprecated type, and nvmet is using uuid_t already.

Signed-off-by Andy Shevchenko <andriy.shevchenko at linux.intel.com>
---
 drivers/nvme/target/admin-cmd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/target/admin-cmd.c +1 -1
index 38803576d5e1..f832be8245cd 100644
@@ -308,7 +308,7 @@ static void nvmet_execute_identify_ns(struct nvmet_req *req)
 	 */
 	id->nmic = (1 << 0);
 
-	memcpy(&id->nguid, &ns->nguid, sizeof(uuid_le));
+	memcpy(&id->nguid, &ns->nguid, 16);
 
 	id->lbaf[0].ds = ns->blksize_shift;
 
Signature · 1 line
2.18.0
maintainer
#1 lore raw

PATCH 1/1 nvmet: Don't use uuid_le type

Reviewed-by Sagi Grimberg <sagi at grimberg.me>
maintainer
#2 lore raw

PATCH 1/1 nvmet: Don't use uuid_le type

In reply to Andy Shevchenko

drivers/nvme/target/admin-cmd.c static void nvmet_execute_identify_ns(struct nvmet_req *req) · line 311

Quoted 3 lines
drivers/nvme/target/admin-cmd.c +1 -1
-	memcpy(&id->nguid, &ns->nguid, sizeof(uuid_le));
+	memcpy(&id->nguid, &ns->nguid, 16);

how about memcpy(&id->nguid, &ns->nguid, sizeof(ns->nguid));

#3 lore raw

PATCH 1/1 nvmet: Don't use uuid_le type

Quoted 4 lines · Sagi Grimberg

drivers/nvme/target/admin-cmd.c static void nvmet_execute_identify_ns(struct nvmet_req *req) · line 311

Quoted 2 lines
drivers/nvme/target/admin-cmd.c +1 -1
-	memcpy(&id->nguid, &ns->nguid, sizeof(uuid_le));
+	memcpy(&id->nguid, &ns->nguid, 16);

how about memcpy(&id->nguid, &ns->nguid, sizeof(ns->nguid));

I suppose should be sizeof(id->nguid), but I don't care much as long as it doesn't use uuid_le type here.

Signature · 2 lines
Andy Shevchenko <andriy.shevchenko at linux.intel.com>
Intel Finland Oy
#4 lore raw

PATCH 1/1 nvmet: Don't use uuid_le type

Quoted 8 lines · Andy Shevchenko
Quoted 4 lines · Sagi Grimberg

drivers/nvme/target/admin-cmd.c static void nvmet_execute_identify_ns(struct nvmet_req *req) · line 311

Quoted 2 lines
drivers/nvme/target/admin-cmd.c +1 -1
-	memcpy(&id->nguid, &ns->nguid, sizeof(uuid_le));
+	memcpy(&id->nguid, &ns->nguid, 16);

how about memcpy(&id->nguid, &ns->nguid, sizeof(ns->nguid));

I suppose should be sizeof(id->nguid), but I don't care much as long as it doesn't use uuid_le type here.

Yes, please use sizeof of the destination field instead of an opencoded number.