Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp764898ybf; Fri, 28 Feb 2020 07:14:09 -0800 (PST) X-Google-Smtp-Source: APXvYqzxKgoB3wOCLXLnmaAxBr+27oZYJdfAd23JkWLqIXv7pxpUz3WX6C0ZbatalDp4bgztdz2S X-Received: by 2002:aca:c6ca:: with SMTP id w193mr3372859oif.165.1582902849696; Fri, 28 Feb 2020 07:14:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582902849; cv=none; d=google.com; s=arc-20160816; b=k4ogguofsM08cb3FlXf8nN2wnkW4A5Fwg+TrLBodrzFcjjmuBS8RInr0HY+yrogVa+ 6jLh0dFa0vjxBp4dqBh20b24q5sRC3eDnt7HKDXJMCIco0xRfKbTznzQ7xUS13fHaO4L rHJ2WuIUAIBgzfZsf3LhQoDBgLeQpMQ+5rfocv8NOIQenkPw+AuY1CrHzkUupynVA1Av KPdFM0lzYZfYxhsZHetpzG5Q1m9HXcAMOUQoPtVF9DjKH9oFEW/l+xkM/OFd7AOhW1iZ mDsZYvVmKIKmrfJFOVBAgD2bQ5JucMvJaM3/qACv/q9E+1G7uuNHlKaBXE5qi1yOqeO/ MPZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=tSsQnuQwZfJLCnfV8zFJCfyiCOdnCpdVKkqNmJNgPWc=; b=KDmTkPDtFU8TvbsxaEfdIBIkiCb4goeOnN0EU6nvK63vXl55JLz+f6lSiCVJWfsmUc 3jfRqq6pg4cW5dOY9DWTrbLm7o7s2UM9ToVq2ZOFppxdcqxcYa6fgVSsa2HhyD9uKKth nF95x3J0aqJNfpVinwgF36PUVL8upGyIc3CDVtb4WpWbB73aNVBOLYRGCiE6/kjFmSTz XpqK/PLqONIQ4wWHumgGCTF29v4HvGLN9PK3ddKm+rDIZkJaQA6P9tAWb9afA4pdmb36 xsUmgMn4Wv6cczK+eqdSBEHU0MOe5hCchX459sharBt0wBN9RDdsNaEJnH89bqZUny93 Wdeg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id w12si1808136otk.77.2020.02.28.07.13.57; Fri, 28 Feb 2020 07:14:09 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1727145AbgB1PNc (ORCPT + 99 others); Fri, 28 Feb 2020 10:13:32 -0500 Received: from mga06.intel.com ([134.134.136.31]:29073 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726947AbgB1PNb (ORCPT ); Fri, 28 Feb 2020 10:13:31 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Feb 2020 07:13:31 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,496,1574150400"; d="scan'208";a="385520271" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga004.jf.intel.com with ESMTP; 28 Feb 2020 07:13:30 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 3719D24D; Fri, 28 Feb 2020 17:13:28 +0200 (EET) From: Andy Shevchenko To: Tomas Winkler , linux-kernel@vger.kernel.org Cc: Andy Shevchenko Subject: [PATCH v1] mei: Don't encourage to use kernel internal types in user code Date: Fri, 28 Feb 2020 17:13:28 +0200 Message-Id: <20200228151328.45062-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.25.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org uuid_le is internal kernel type which shall not be exposed to the user in the first place. In order to mitigate the (wrong) distribution of the use of that type, switch MEI AMT sample to plain unsigned char array. Note, there is no ABI change involved. Signed-off-by: Andy Shevchenko --- samples/mei/mei-amt-version.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/samples/mei/mei-amt-version.c b/samples/mei/mei-amt-version.c index 32234481ad7d..458cb6db57c6 100644 --- a/samples/mei/mei-amt-version.c +++ b/samples/mei/mei-amt-version.c @@ -90,7 +90,7 @@ } while (0) struct mei { - uuid_le guid; + unsigned char guid[16]; bool initialized; bool verbose; unsigned int buf_size; @@ -108,7 +108,7 @@ static void mei_deinit(struct mei *cl) cl->initialized = false; } -static bool mei_init(struct mei *me, const uuid_le *guid, +static bool mei_init(struct mei *me, const unsigned char *guid, unsigned char req_protocol_version, bool verbose) { int result; @@ -126,7 +126,7 @@ static bool mei_init(struct mei *me, const uuid_le *guid, memset(&data, 0, sizeof(data)); me->initialized = true; - memcpy(&data.in_client_uuid, &me->guid, sizeof(me->guid)); + memcpy(&data.in_client_uuid, me->guid, sizeof(me->guid)); result = ioctl(me->fd, IOCTL_MEI_CONNECT_CLIENT, &data); if (result) { mei_err(me, "IOCTL_MEI_CONNECT_CLIENT receive message. err=%d\n", result); @@ -270,8 +270,11 @@ struct amt_host_if_resp_header { unsigned char data[0]; } __attribute__((packed)); -const uuid_le MEI_IAMTHIF = UUID_LE(0x12f80028, 0xb4b7, 0x4b2d, \ - 0xac, 0xa8, 0x46, 0xe0, 0xff, 0x65, 0x81, 0x4c); +/* MEI AMT Interface GUID: 12f80028-b4b7-4b2d-aca8-46e0ff65814c */ +const unsigned char mei_iamthif[16] = { + 0x28, 0x00, 0xf8, 0x12, 0xb7, 0xb4, 0x2d, 0x4b, + 0xac, 0xa8, 0x46, 0xe0, 0xff, 0x65, 0x81, 0x4c, +}; #define AMT_HOST_IF_CODE_VERSIONS_REQUEST 0x0400001A #define AMT_HOST_IF_CODE_VERSIONS_RESPONSE 0x0480001A @@ -295,7 +298,7 @@ static bool amt_host_if_init(struct amt_host_if *acmd, unsigned long send_timeout, bool verbose) { acmd->send_timeout = (send_timeout) ? send_timeout : 20000; - acmd->initialized = mei_init(&acmd->mei_cl, &MEI_IAMTHIF, 0, verbose); + acmd->initialized = mei_init(&acmd->mei_cl, mei_iamthif, 0, verbose); return acmd->initialized; } -- 2.25.0