Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp356890pxb; Wed, 14 Apr 2021 17:42:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwZw8DmM+uOAi0QyGZlWqS3QywyiVHar6YpWeRxeg9SbYXAG7NrhpFuaPRlYhs907HH95YQ X-Received: by 2002:a17:90a:4e5:: with SMTP id g92mr819162pjg.165.1618447356916; Wed, 14 Apr 2021 17:42:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618447356; cv=none; d=google.com; s=arc-20160816; b=NKaCrOxLhSCiK18oJfb78kRJQ+u1w+X7Co+zA7ybPObcnZhDxTL0JVXkb2Z7kILeC0 ka3bfxh4MLRIe4tYENudVjnG61lf9n4qzrnECrVtq9igGudIvw05Xf14X4Yuo/VbZw0f T5ERg+rlKcoLCzPR0hZa38NeJhLVfoTEovi4hNmVA4hz27hygA9XB3UOfQmo3YKYz0fg aIsEAs1yFKAfkGP447uYP4mvNhSyx9lLvv54naXnosugbSObfcjCQyymY6WSiyInFNR3 jJIEkndKnkCn9p3qjSSyzMT6ZMqmIvDnd0SraK/qyGp/wDk11mD9OvcuJTMfl0o8PDEB ebZA== 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=nBHbfmSH6AUzkVoXS+PbHGPY+QhOqrHmqQ+s5/s0aG8=; b=prtwmtInUNmIsqXBjXOc7kn5w6b+G4J+X1iw88UyzEnnDmgp52FR4gd+ybR2dXUGj3 QSyIKMOyTI1WHOZ75Srpq4R59vXbGCjjHpFUg7tSiHWrAHjOcnrbrSWvOIfv3Ldjo9Vl fIybnLL7Ly/AsJiR94/ihbIryytTwLqZ5EKBP/O/A38X9qgsAnOJQugX7d7wN2CSTZAN 2FWCvgrye21cjrE2G1VOG/SiAo1JPoXpTsKP+w0y+yk99LqkPbOt1wYmHlZI7wKddsu+ qJoR+tJ/3P1x5gpYB4JJ7kHPH662lYC66oHcd48MnrqD6+IfZsJJc0WsZBBFiPGkU4Es 1aRA== 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 k15si1338819plk.106.2021.04.14.17.42.24; Wed, 14 Apr 2021 17:42:36 -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 S1345726AbhDNTQc (ORCPT + 99 others); Wed, 14 Apr 2021 15:16:32 -0400 Received: from mga01.intel.com ([192.55.52.88]:41716 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347863AbhDNTQ1 (ORCPT ); Wed, 14 Apr 2021 15:16:27 -0400 IronPort-SDR: sOEVM88M4j3KVm7PNFy07/Bf83Y0k45RswZ2VulBP5oVpwFtE49wqgFT1MpiMeMWJn2hztKlNC nkzU22BbMvsw== X-IronPort-AV: E=McAfee;i="6200,9189,9954"; a="215211993" X-IronPort-AV: E=Sophos;i="5.82,223,1613462400"; d="scan'208";a="215211993" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Apr 2021 12:16:06 -0700 IronPort-SDR: 1zt3d8op+1asmS9HeqADSdgpMhHskIgdY2aMVRSdZ5sV+FVFy7SYATA/+eM6MGlQ+GVsQ6Sg+Y Dnm2L2HA9/sw== X-IronPort-AV: E=Sophos;i="5.82,223,1613462400"; d="scan'208";a="461333436" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Apr 2021 12:16:04 -0700 Received: from andy by smile with local (Exim 4.94) (envelope-from ) id 1lWkzZ-00457j-Ut; Wed, 14 Apr 2021 22:16:01 +0300 Date: Wed, 14 Apr 2021 22:16:01 +0300 From: Andy Shevchenko To: Alexander Shishkin Cc: Greg Kroah-Hartman , 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> <87sg3sfzl1.fsf@ashishki-desk.ger.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87sg3sfzl1.fsf@ashishki-desk.ger.corp.intel.com> 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 10:14:34PM +0300, Alexander Shishkin wrote: > Greg Kroah-Hartman 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 > 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 > [ash: changed back to uuid_t and updated the commit message] > Signed-off-by: Alexander Shishkin > --- > 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