All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: cgel.zte@gmail.com
Cc: mingo@redhat.com, mark.rutland@arm.com,
	alexander.shishkin@linux.intel.com, jolsa@kernel.org,
	namhyung@kernel.org, adrian.hunter@intel.com,
	atrajeev@linux.vnet.ibm.com, ak@linux.intel.com,
	kan.liang@linux.intel.com, deng.changcheng@zte.com.cn,
	german.gomez@arm.com, linux-perf-users@vger.kernel.org,
	linux-kernel@vger.kernel.org, Zeal Robot <zealci@zte.com.cn>
Subject: Re: [PATCH] perf tools: Replace zero-length array with flexible-array member
Date: Fri, 18 Feb 2022 09:58:57 -0300	[thread overview]
Message-ID: <Yg+YEfv5vvT3RIxy@kernel.org> (raw)
In-Reply-To: <20220218031352.1906077-1-deng.changcheng@zte.com.cn>

Em Fri, Feb 18, 2022 at 03:13:52AM +0000, cgel.zte@gmail.com escreveu:
> From: Changcheng Deng <deng.changcheng@zte.com.cn>
> 
> There is a regular need in the kernel to provide a way to declare having
> a dynamically sized set of trailing elements in a structure. Kernel code
> should always use "flexible array members" for these cases. The older
> style of one-element or zero-length arrays should no longer be used.
> Reference:
> https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays
> 
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Changcheng Deng <deng.changcheng@zte.com.cn>

You can't do that as this will break the build as explained in that
patch e-mail thread.

Adrian provided an alternative patch that I have to process.

Thanks for the patch anyway,

- Arnaldo

> ---
>  tools/perf/util/event.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h
> index cdd72e05fd28..320cbcd5b902 100644
> --- a/tools/perf/util/event.h
> +++ b/tools/perf/util/event.h
> @@ -308,7 +308,7 @@ struct perf_synth_intel_evt {
>  		};
>  		u32	cfe;
>  	};
> -	struct perf_synth_intel_evd evd[0];
> +	struct perf_synth_intel_evd evd[];
>  };
>  
>  struct perf_synth_intel_iflag_chg {
> -- 
> 2.25.1

-- 

- Arnaldo

      reply	other threads:[~2022-02-18 12:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-18  3:13 [PATCH] perf tools: Replace zero-length array with flexible-array member cgel.zte
2022-02-18 12:58 ` Arnaldo Carvalho de Melo [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Yg+YEfv5vvT3RIxy@kernel.org \
    --to=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=ak@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=atrajeev@linux.vnet.ibm.com \
    --cc=cgel.zte@gmail.com \
    --cc=deng.changcheng@zte.com.cn \
    --cc=german.gomez@arm.com \
    --cc=jolsa@kernel.org \
    --cc=kan.liang@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=zealci@zte.com.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.