Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp355165pxb; Wed, 14 Apr 2021 17:39:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwJg1ofiecLgicXD0cbRWuaYvwBGOV5QKxPyqy35/BFSklfRQbNBUsWUDMO6sncEMiMy+mx X-Received: by 2002:a05:6402:6c1:: with SMTP id n1mr995165edy.158.1618447151294; Wed, 14 Apr 2021 17:39:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618447151; cv=none; d=google.com; s=arc-20160816; b=tkp9WexX6gdMQdD7YJ95OV9/QPOl/GjDZar3Go1+mXb7VP5VmK7WkgYdMqb+f/JcXN E7WIFaZzpL6t+4hkDtES32CFbyeP2kcOc8u8IgOSrulwnI4fPHlIE5T9LrhuOZxuZVlj Y+QJe/X8Acuwt2vvdT7AZUDYY+2ebJQ86atTrAO0eHZaT9BHLjQCQX0ArYTkVY28Jpu8 m8drViW62rVFNW3nLvMwhld11JSVu4y6vI+7rvXy9TyTVZM1QqkGJbIjpyqDnL+Ej+wG L+DLcJFf+sPhm7mrKLtJdz7gQ1iObk0r3TOZRLR4CulKSMQLQ1aqz4Yb+LOxdODce9Kt 6DWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :ironport-sdr:ironport-sdr; bh=0UVD8SX4PzV7cKknPJf+B3dG1zUdFLXladMkFjusexo=; b=PoGjd5VBqCBet/JfsuqnivEabSlqOEapvklMlW9opkPyhz8O5lLPzxMXZk+HbxbtM6 e2VNv6VJk/ZAFuJ+2NMi8xd6hOVhe9PyEmYmVcmrXgpa85N4prK3Ou48iWMGgq4HBVlo IJQpyAdIfEEt+k5nCdW2Pq1hoA9JRRWYUGRLiNvypDhkIEWfQOvHQ09szMY14ehum1Ua g2k0nx3tN0OOT2OOtOcEzX1Bxizw2kQsh4Pa6Jwpf/XHlst8dB8eeOQ+Kd4yl55JbJSS XAqJnHxPlukfoT+kQNSlZPgkPsCmjSGCUiXQjkqzg4+e39aez35SlaCAf52ZItlL+4MC 2vlw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bq19si979719edb.311.2021.04.14.17.38.48; Wed, 14 Apr 2021 17:39:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350705AbhDNRsR (ORCPT + 99 others); Wed, 14 Apr 2021 13:48:17 -0400 Received: from mga02.intel.com ([134.134.136.20]:6222 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347548AbhDNRsQ (ORCPT ); Wed, 14 Apr 2021 13:48:16 -0400 IronPort-SDR: AnoPP3E8d8vjuCFMEndTITgHT+dwOzSascGcx/YUxg/Du1uMpERIaey9szqUB3RS59/4OjlELe nfuHJhFsc0KQ== X-IronPort-AV: E=McAfee;i="6200,9189,9954"; a="181819973" X-IronPort-AV: E=Sophos;i="5.82,223,1613462400"; d="scan'208";a="181819973" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Apr 2021 10:47:52 -0700 IronPort-SDR: 03bq64kSY2elvsiAhmZgjE30QST8Yse36lzk12d1PYG9635GKYhu/hTLN6NQ1hEWUkcv7cK4Mz HGyppFRHgvlg== X-IronPort-AV: E=Sophos;i="5.82,223,1613462400"; d="scan'208";a="522073477" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Apr 2021 10:47:50 -0700 Received: from andy by smile with local (Exim 4.94) (envelope-from ) id 1lWjcC-0043yy-8l; Wed, 14 Apr 2021 20:47:48 +0300 Date: Wed, 14 Apr 2021 20:47:48 +0300 From: Andy Shevchenko To: Greg Kroah-Hartman Cc: Alexander Shishkin , linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/7] stm class: Replace uuid_t with plain u8 uuid[16] Message-ID: References: <20210414171251.14672-1-alexander.shishkin@linux.intel.com> <20210414171251.14672-3-alexander.shishkin@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 14, 2021 at 07:33:38PM +0200, Greg Kroah-Hartman wrote: > On Wed, Apr 14, 2021 at 08:12:46PM +0300, Alexander Shishkin wrote: > > From: Andy Shevchenko > > > > It appears that uuid_t use in STM code abuses UUID API. > > How is it being abused? We are using it against the buffer that is u8, and neither uuid_t nor guid_t. > Moreover, > > this type is only useful when we parse user input. Due to above > > replace uuid_t with u8 uuid[16] and use uuid_t only when parse > > user input. > > > > Signed-off-by: Andy Shevchenko > > Signed-off-by: Alexander Shishkin > > --- > > drivers/hwtracing/stm/p_sys-t.c | 16 ++++++++++------ > > 1 file changed, 10 insertions(+), 6 deletions(-) > > > > diff --git a/drivers/hwtracing/stm/p_sys-t.c b/drivers/hwtracing/stm/p_sys-t.c > > index 360b5c03df95..04d13b3785d3 100644 > > --- a/drivers/hwtracing/stm/p_sys-t.c > > +++ b/drivers/hwtracing/stm/p_sys-t.c > > @@ -76,7 +76,7 @@ enum sys_t_message_string_subtype { > > MIPI_SYST_SEVERITY(MAX)) > > > > struct sys_t_policy_node { > > - uuid_t uuid; > > + u8 uuid[UUID_SIZE]; > > This feels wrong, what is wrong with the uuid_t type usage here? Nothing, just will require additional export_uuid() / import_uuid() call. > > bool do_len; > > unsigned long ts_interval; > > unsigned long clocksync_interval; > > @@ -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); > > Ok, that's not good, but that looks to be a flaw in the > generate_random_uuid() api, not this driver implementation. > > I don't understand why this change is needed? Using raw buffer APIs against uuid_t / guid_t. We can import_uuid() first and call uuid_gen() against it. Will it work for you? -- With Best Regards, Andy Shevchenko