All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] nvmet: Don't use uuid_le type
@ 2018-07-16  9:59 Andy Shevchenko
  2018-07-16 10:26 ` Sagi Grimberg
  2018-07-16 10:27 ` Sagi Grimberg
  0 siblings, 2 replies; 5+ messages in thread
From: Andy Shevchenko @ 2018-07-16  9:59 UTC (permalink / raw)


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(-)

diff --git a/drivers/nvme/target/admin-cmd.c b/drivers/nvme/target/admin-cmd.c
index 38803576d5e1..f832be8245cd 100644
--- a/drivers/nvme/target/admin-cmd.c
+++ b/drivers/nvme/target/admin-cmd.c
@@ -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;
 
-- 
2.18.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v1] nvmet: Don't use uuid_le type
  2018-07-16  9:59 [PATCH v1] nvmet: Don't use uuid_le type Andy Shevchenko
@ 2018-07-16 10:26 ` Sagi Grimberg
  2018-07-16 10:27 ` Sagi Grimberg
  1 sibling, 0 replies; 5+ messages in thread
From: Sagi Grimberg @ 2018-07-16 10:26 UTC (permalink / raw)


Reviewed-by: Sagi Grimberg <sagi at grimberg.me>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v1] nvmet: Don't use uuid_le type
  2018-07-16  9:59 [PATCH v1] nvmet: Don't use uuid_le type Andy Shevchenko
  2018-07-16 10:26 ` Sagi Grimberg
@ 2018-07-16 10:27 ` Sagi Grimberg
  2018-07-16 12:03   ` Andy Shevchenko
  1 sibling, 1 reply; 5+ messages in thread
From: Sagi Grimberg @ 2018-07-16 10:27 UTC (permalink / raw)



> -	memcpy(&id->nguid, &ns->nguid, sizeof(uuid_le));
> +	memcpy(&id->nguid, &ns->nguid, 16);

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v1] nvmet: Don't use uuid_le type
  2018-07-16 10:27 ` Sagi Grimberg
@ 2018-07-16 12:03   ` Andy Shevchenko
  2018-07-17 13:14     ` Christoph Hellwig
  0 siblings, 1 reply; 5+ messages in thread
From: Andy Shevchenko @ 2018-07-16 12:03 UTC (permalink / raw)


On Mon, 2018-07-16@13:27 +0300, Sagi Grimberg wrote:
> > -	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.

-- 
Andy Shevchenko <andriy.shevchenko at linux.intel.com>
Intel Finland Oy

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v1] nvmet: Don't use uuid_le type
  2018-07-16 12:03   ` Andy Shevchenko
@ 2018-07-17 13:14     ` Christoph Hellwig
  0 siblings, 0 replies; 5+ messages in thread
From: Christoph Hellwig @ 2018-07-17 13:14 UTC (permalink / raw)


On Mon, Jul 16, 2018@03:03:27PM +0300, Andy Shevchenko wrote:
> On Mon, 2018-07-16@13:27 +0300, Sagi Grimberg wrote:
> > > -	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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-07-17 13:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-16  9:59 [PATCH v1] nvmet: Don't use uuid_le type Andy Shevchenko
2018-07-16 10:26 ` Sagi Grimberg
2018-07-16 10:27 ` Sagi Grimberg
2018-07-16 12:03   ` Andy Shevchenko
2018-07-17 13:14     ` Christoph Hellwig

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.