LKML Archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/7] stm class: Replace uuid_t with plain u8 uuid[16]
Date: Wed, 14 Apr 2021 22:16:01 +0300	[thread overview]
Message-ID: <YHc/cQAmLLOXwLLB@smile.fi.intel.com> (raw)
In-Reply-To: <87sg3sfzl1.fsf@ashishki-desk.ger.corp.intel.com>

On Wed, Apr 14, 2021 at 10:14:34PM +0300, Alexander Shishkin wrote:
> Greg Kroah-Hartman <gregkh@linuxfoundation.org> writes:
> 
> >> Using raw buffer APIs against uuid_t / guid_t.
> >
> > So you want to do that, or you do not want to do that?  Totally
> > confused,
> 
> My understanding is that:
> 1) generate_random_uuid() use is allegedly bad even though it's in their
> header,
> 2) poking directly at the byte array inside uuid_t is bad, even though,
> again, header.
> 
> It is, indeed, not ideal.
> 
> If agreeable, I'll update this patch to the below and respin the whole
> series.

Below patch looks good to me, thanks!

> From 02340f8c7c17ace028040a35553c33cce8f3bce4 Mon Sep 17 00:00:00 2001
> From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Date: Wed, 22 Apr 2020 16:02:20 +0300
> Subject: [PATCH] stm class: Use correct UUID APIs
> 
> It appears that the STM code didn't manage to accurately decypher the
> delicate inner workings of an alternative thought process behind the
> UUID API and directly called generate_random_uuid() that clearly needs
> to be a static function in lib/uuid.c.
> 
> At the same time, said STM code is poking directly at the byte array
> inside the uuid_t when it uses the UUID for its internal purposes.
> 
> Fix these two transgressions by using intended APIs instead.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> [ash: changed back to uuid_t and updated the commit message]
> Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
> ---
>  drivers/hwtracing/stm/p_sys-t.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/hwtracing/stm/p_sys-t.c b/drivers/hwtracing/stm/p_sys-t.c
> index 360b5c03df95..8254971c02e7 100644
> --- a/drivers/hwtracing/stm/p_sys-t.c
> +++ b/drivers/hwtracing/stm/p_sys-t.c
> @@ -92,7 +92,7 @@ static void sys_t_policy_node_init(void *priv)
>  {
>  	struct sys_t_policy_node *pn = priv;
>  
> -	generate_random_uuid(pn->uuid.b);
> +	uuid_gen(&pn->uuid);
>  }
>  
>  static int sys_t_output_open(void *priv, struct stm_output *output)
> @@ -292,6 +292,7 @@ static ssize_t sys_t_write(struct stm_data *data, struct stm_output *output,
>  	unsigned int m = output->master;
>  	const unsigned char nil = 0;
>  	u32 header = DATA_HEADER;
> +	u8 uuid[UUID_SIZE];
>  	ssize_t sz;
>  
>  	/* We require an existing policy node to proceed */
> @@ -322,7 +323,8 @@ static ssize_t sys_t_write(struct stm_data *data, struct stm_output *output,
>  		return sz;
>  
>  	/* GUID */
> -	sz = stm_data_write(data, m, c, false, op->node.uuid.b, UUID_SIZE);
> +	export_uuid(uuid, &op->node.uuid);
> +	sz = stm_data_write(data, m, c, false, uuid, sizeof(op->node.uuid));
>  	if (sz <= 0)
>  		return sz;
>  
> -- 
> 2.30.2
> 

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2021-04-14 19:16 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-14 17:12 [PATCH 0/7] stm class/intel_th: Updates for v5.13 Alexander Shishkin
2021-04-14 17:12 ` [PATCH 1/7] stm class: Remove an unused function Alexander Shishkin
2021-04-14 17:12 ` [PATCH 2/7] stm class: Replace uuid_t with plain u8 uuid[16] Alexander Shishkin
2021-04-14 17:33   ` Greg Kroah-Hartman
2021-04-14 17:47     ` Andy Shevchenko
2021-04-14 18:56       ` Greg Kroah-Hartman
2021-04-14 19:12         ` Andy Shevchenko
2021-04-14 19:14         ` Alexander Shishkin
2021-04-14 19:16           ` Andy Shevchenko [this message]
2021-04-15  8:34           ` Greg Kroah-Hartman
2021-04-15  8:48             ` Andy Shevchenko
2021-04-15  9:08               ` Greg Kroah-Hartman
2021-04-15  9:20             ` Alexander Shishkin
2021-04-14 17:12 ` [PATCH 3/7] intel_th: Constify all drvdata references Alexander Shishkin
2021-04-14 17:12 ` [PATCH 4/7] intel_th: Constify attribute_group structs Alexander Shishkin
2021-04-14 17:12 ` [PATCH 5/7] intel_th: Consistency and off-by-one fix Alexander Shishkin
2021-04-14 17:12 ` [PATCH 6/7] intel_th: pci: Add Rocket Lake CPU support Alexander Shishkin
2021-04-14 17:12 ` [PATCH 7/7] intel_th: pci: Add Alder Lake-M support Alexander Shishkin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YHc/cQAmLLOXwLLB@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).