From mboxrd@z Thu Jan 1 00:00:00 1970 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=-0.7 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no 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 CED20C43461 for ; Fri, 16 Apr 2021 17:34:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B6C70613B7 for ; Fri, 16 Apr 2021 17:34:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242868AbhDPReb (ORCPT ); Fri, 16 Apr 2021 13:34:31 -0400 Received: from mga03.intel.com ([134.134.136.65]:37573 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242750AbhDPRe3 (ORCPT ); Fri, 16 Apr 2021 13:34:29 -0400 IronPort-SDR: kT8fvSO23NneSoNx033pmcixx9HOJuOcpWyqlGHS+ZULOA5DL98BSDI9CDPzY65KXZwIyh6kyW rTcWsCVU5aZg== X-IronPort-AV: E=McAfee;i="6200,9189,9956"; a="195101020" X-IronPort-AV: E=Sophos;i="5.82,226,1613462400"; d="scan'208";a="195101020" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Apr 2021 10:34:00 -0700 IronPort-SDR: tQrUzqzEe3V356yqOX8dVKzGb6oKF+Dpyp4L/dGsykNQFKvpC6rCseUSSOQKMjSHKIaMDLo+Fk 6DHuR+ZeKZYA== X-IronPort-AV: E=Sophos;i="5.82,226,1613462400"; d="scan'208";a="425668212" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Apr 2021 10:33:58 -0700 Received: from andy by smile with local (Exim 4.94) (envelope-from ) id 1lXSLr-004iQM-GJ; Fri, 16 Apr 2021 20:33:55 +0300 Date: Fri, 16 Apr 2021 20:33:55 +0300 From: Andy Shevchenko To: Dan Williams Cc: linux-nvdimm , Linux ACPI , Linux Kernel Mailing List , Vishal Verma , Dave Jiang , Ira Weiny , "Rafael J. Wysocki" , Len Brown Subject: Re: [PATCH v1 1/1] ACPI: NFIT: Import GUID before use Message-ID: References: <20210415135901.47131-1-andriy.shevchenko@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 Fri, Apr 16, 2021 at 09:15:34AM -0700, Dan Williams wrote: > On Fri, Apr 16, 2021 at 1:58 AM Andy Shevchenko > wrote: > > On Fri, Apr 16, 2021 at 8:28 AM Dan Williams wrote: > > > On Thu, Apr 15, 2021 at 6:59 AM Andy Shevchenko > > > wrote: > > > > > > > > Strictly speaking the comparison between guid_t and raw buffer > > > > is not correct. Import GUID to variable of guid_t type and then > > > > compare. > > > > > > Hmm, what about something like the following instead, because it adds > > > safety. Any concerns about evaluating x twice in a macro should be > > > alleviated by the fact that ARRAY_SIZE() will fail the build if (x) is > > > not an array. > > > > ARRAY_SIZE doesn't check type. > > See __must_be_array. > > > I don't like hiding ugly casts like this. > > See PTR_ERR, ERR_PTR, ERR_CAST. It's special, i.e. error pointer case. We don't handle such here. > There's nothing broken about the way the code currently stands, so I'd > rather try to find something to move the implementation forward than > sideways. Submit a patch then. I rest my case b/c I consider that ugly castings worse than additional API call, although it's not ideal. -- With Best Regards, Andy Shevchenko