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=-8.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS 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 6640DC2D0F0 for ; Mon, 30 Mar 2020 19:55:14 +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 3256F20733 for ; Mon, 30 Mar 2020 19:55:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=intel-com.20150623.gappssmtp.com header.i=@intel-com.20150623.gappssmtp.com header.b="l9UrcbgG" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3256F20733 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=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 AD7C210FC340C; Mon, 30 Mar 2020 12:56:03 -0700 (PDT) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2a00:1450:4864:20::543; helo=mail-ed1-x543.google.com; envelope-from=dan.j.williams@intel.com; receiver= Received: from mail-ed1-x543.google.com (mail-ed1-x543.google.com [IPv6:2a00:1450:4864:20::543]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id D3B201007A83C for ; Mon, 30 Mar 2020 12:56:01 -0700 (PDT) Received: by mail-ed1-x543.google.com with SMTP id de14so22292169edb.4 for ; Mon, 30 Mar 2020 12:55:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=0m2AnfIRcCHRpZW6PDeIax9gdSThqigcANOhQSHQQRM=; b=l9UrcbgGyZHpzzpXZ0ao5T6qmamT4bwpPo9Q1ZImIf8A7LLg6hVilR0KrN4O3gamsX TTDYIQCaPyZJm/VklimIRgeNaVSOlkAPYBcWC6u4lLFVoKVG3GvRC4sgvM5WwLN230cR NqacKnMDiHYRg5NxBw2W+fdR/djzIb+BwQuL5HGUnGcaGsEKVpBQA6Ibaza1SI8dNSo4 1wCRpauHNIBwEuVetbcLpEdV1LxzYnn6SincBoe4V3EhF3iBRM/JOpP5Gm6ettn+PyeR kd8ucX/kUEddGzeLrJ8AcsMIcaAHlPDS+29wJSZpBltd4kvSmndVWXZiizq1H4clGtmK Zjrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=0m2AnfIRcCHRpZW6PDeIax9gdSThqigcANOhQSHQQRM=; b=G2bfomvyDHd4NBGTx4hJwp3IVsDb8TdKBEOy9Xj1L7IP1fEUHdPV27RTQ9/4hTqM3k KujR24jiELbGSieqI2FYxLkWvJnAWi5R0C3ngsOkwW+w54fZAjKxpK9CDCoqSM5xWO4w 13a8W4rkrGGRAiwoVXwA/1cYVoY4S2v5VgZgGcBvBvB41cKRa/4m9llsG+kL7y+cR797 W29cVqY+0nMJ42tJCselAj6R85XmqpgXkur8G7eeNaNpzpLu8dbepgQMDNVHUMd5qv2m nRK9DqG/h3yrQinBpUdddQEcQxKxLYUk30Nvo1tw3TEVEE0RVE9F7IXYLZsemeLNCePq j6Lg== X-Gm-Message-State: ANhLgQ1ptkuDOuogh+xjTkoPVvf1qk+DrXrH7Pavc6m0BSbzzdLkxQwP jQ4U4gmQ8w/L6rLtoRnJk+1/FrWT30eXiUKZCjyhwA== X-Google-Smtp-Source: ADFU+vuRYf2PNGMfKGMR9APzvmfg1zGeVpB4kVz6LrQE2pYYEguvqYB2rhx1GF+WePdck7GQUX3jq1SI88VCcV1b6Hc= X-Received: by 2002:a17:906:1697:: with SMTP id s23mr12715702ejd.211.1585598108932; Mon, 30 Mar 2020 12:55:08 -0700 (PDT) MIME-Version: 1.0 References: <20200319195046.GA452@embeddedor.com> In-Reply-To: From: Dan Williams Date: Mon, 30 Mar 2020 12:54:57 -0700 Message-ID: Subject: Re: [PATCH][next] acpi: nfit.h: Replace zero-length array with flexible-array member To: "Rafael J. Wysocki" Message-ID-Hash: QKWACDS5MT5XIHIK5D3ZQQLES6OCKHC4 X-Message-ID-Hash: QKWACDS5MT5XIHIK5D3ZQQLES6OCKHC4 X-MailFrom: dan.j.williams@intel.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: "Gustavo A. R. Silva" , "Rafael J. Wysocki" , Len Brown , "linux-nvdimm@lists.01.org" , ACPI Devel Maling List , Linux Kernel Mailing List 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: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit On Wed, Mar 25, 2020 at 3:06 AM Rafael J. Wysocki wrote: > > On Thu, Mar 19, 2020 at 9:15 PM Gustavo A. R. Silva > wrote: > > > > The current codebase makes use of the zero-length array language > > extension to the C90 standard, but the preferred mechanism to declare > > variable-length types such as these ones is a flexible array member[1][2], > > introduced in C99: > > > > struct foo { > > int stuff; > > struct boo array[]; > > }; > > > > By making use of the mechanism above, we will get a compiler warning > > in case the flexible array does not occur last in the structure, which > > will help us prevent some kind of undefined behavior bugs from being > > inadvertently introduced[3] to the codebase from now on. > > > > Also, notice that, dynamic memory allocations won't be affected by > > this change: > > > > "Flexible array members have incomplete type, and so the sizeof operator > > may not be applied. As a quirk of the original implementation of > > zero-length arrays, sizeof evaluates to zero."[1] > > > > This issue was found with the help of Coccinelle. > > > > [1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html > > [2] https://github.com/KSPP/linux/issues/21 > > [3] commit 76497732932f ("cxgb3/l2t: Fix undefined behaviour") > > > > Signed-off-by: Gustavo A. R. Silva > > Dan, > > I'm assuming that you will take care of this one or please let me know > otherwise. Yes, this one and the other 2 related libnvdimm fixups are in my queue. _______________________________________________ Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org To unsubscribe send an email to linux-nvdimm-leave@lists.01.org