From patchwork Thu Apr 15 14:37:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 12205615 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.9 required=3.0 tests=BAYES_50, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6D557C433B4 for ; Thu, 15 Apr 2021 14:37:49 +0000 (UTC) Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E721461139 for ; Thu, 15 Apr 2021 14:37:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E721461139 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-nvdimm-bounces@lists.01.org Received: from ml01.vlan13.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id C266B100EAB61; Thu, 15 Apr 2021 07:37:48 -0700 (PDT) Received-SPF: None (mailfrom) identity=mailfrom; client-ip=134.134.136.100; helo=mga07.intel.com; envelope-from=andriy.shevchenko@linux.intel.com; receiver= Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id D7416100EAB5E for ; Thu, 15 Apr 2021 07:37:45 -0700 (PDT) IronPort-SDR: Gyo8ZpL+q0VQfTafuKEoT79ZAr8dtEuJFRVukAvqwVW9nLdhD0uxVIGUNotQmbHEh1Ybky2IQA ol7tZdEQH20w== X-IronPort-AV: E=McAfee;i="6200,9189,9955"; a="258822464" X-IronPort-AV: E=Sophos;i="5.82,225,1613462400"; d="scan'208";a="258822464" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Apr 2021 07:37:45 -0700 IronPort-SDR: BGvb9CnNE+3hJ44yKpVysWJC+0nWnLvDs07AdBmA8RvT2cyO9ZO2b/1AZAPc890tzjU2q07BEU W5yJm7549imQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,225,1613462400"; d="scan'208";a="382745459" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga003.jf.intel.com with ESMTP; 15 Apr 2021 07:37:42 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id A7483BA; Thu, 15 Apr 2021 17:37:59 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , linux-nvdimm@lists.01.org, linux-kernel@vger.kernel.org Cc: Dan Williams , Vishal Verma , Dave Jiang , Ira Weiny Subject: [PATCH v1 1/1] libnvdimm: Don't use GUID APIs against raw buffer Date: Thu, 15 Apr 2021 17:37:54 +0300 Message-Id: <20210415143754.16553-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Message-ID-Hash: M25BLCI4X5MDRTPXM3RTDLJGGBMFZPKG X-Message-ID-Hash: M25BLCI4X5MDRTPXM3RTDLJGGBMFZPKG X-MailFrom: andriy.shevchenko@linux.intel.com X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation X-Mailman-Version: 3.1.1 Precedence: list List-Id: "Linux-nvdimm developer list." Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Strictly speaking the comparison between guid_t and raw buffer is not correct. Return to plain memcmp() since the data structures haven't changed to use uuid_t / guid_t the current state of affairs is inconsistent. Either it should be changed altogether or left as is. Signed-off-by: Andy Shevchenko --- drivers/nvdimm/btt_devs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/nvdimm/btt_devs.c b/drivers/nvdimm/btt_devs.c index 05feb97e11ce..82bcd2e86a18 100644 --- a/drivers/nvdimm/btt_devs.c +++ b/drivers/nvdimm/btt_devs.c @@ -244,13 +244,14 @@ struct device *nd_btt_create(struct nd_region *nd_region) */ bool nd_btt_arena_is_valid(struct nd_btt *nd_btt, struct btt_sb *super) { + static const u8 null_uuid[16]; const u8 *parent_uuid = nd_dev_to_uuid(&nd_btt->ndns->dev); u64 checksum; if (memcmp(super->signature, BTT_SIG, BTT_SIG_LEN) != 0) return false; - if (!guid_is_null((guid_t *)&super->parent_uuid)) + if (memcmp(super->parent_uuid, null_uuid, 16) != 0) if (memcmp(super->parent_uuid, parent_uuid, 16) != 0) return false;