public inbox for linux-edac@vger.kernel.org
 help / color / mirror / Atom feed
From: Yazen Ghannam <yazen.ghannam@amd.com>
To: Rosen Penev <rosenp@gmail.com>
Cc: linux-edac@vger.kernel.org, Borislav Petkov <bp@alien8.de>,
	Tony Luck <tony.luck@intel.com>, Kees Cook <kees@kernel.org>,
	"Gustavo A. R. Silva" <gustavoars@kernel.org>,
	open list <linux-kernel@vger.kernel.org>,
	"open list:KERNEL HARDENING (not covered by other
	areas):Keyword:b__counted_by(_le|_be)?b"
	<linux-hardening@vger.kernel.org>
Subject: Re: [PATCH] EDAC/mc: Use kzalloc_flex()
Date: Thu, 19 Mar 2026 13:15:37 -0400	[thread overview]
Message-ID: <20260319171537.GD1666212@yaz-khff2.amd.com> (raw)
In-Reply-To: <20260312050813.9915-1-rosenp@gmail.com>

On Wed, Mar 11, 2026 at 10:08:13PM -0700, Rosen Penev wrote:
> Change kzalloc + kcalloc to just kzalloc with a flexible array member.
> 
> Add __counted_by for extra runtime analysis when requested.
> 
> Move counting assignment immediately after allocation as required by
> __counted_by.
> 

[...]

> diff --git a/include/linux/edac.h b/include/linux/edac.h
[...]
> -	unsigned int n_layers;
> -	struct edac_mc_layer *layers;
>  	bool csbased;
>  
>  	/*
> @@ -609,6 +598,18 @@ struct mem_ctl_info {
>  	u8 fake_inject_layer[EDAC_MAX_LAYERS];
>  	bool fake_inject_ue;
>  	u16 fake_inject_count;
> +
[...]
> +	unsigned int n_layers;
> +	struct edac_mc_layer layers[] __counted_by(n_layers);
>  };
>  

So this is not a just an in-place macro conversion, correct?

You're redefining 'struct mem_ctl_info' to have a flexible array member.
I see this was done with the SB and i7 modules.

I'd prefer if this was explicitly stated in the commit message.

  "Convert struct mem_ctl_info to use flex array...and use the new flex
  array helpers to simplify initialization..."

Just an example of some highlights ^^^.

Otherwise, looks good to me.

Reviewed-by: Yazen Ghannam <yazen.ghannam@amd.com>

Thanks,
Yazen

      reply	other threads:[~2026-03-19 17:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-12  5:08 [PATCH] EDAC/mc: Use kzalloc_flex() Rosen Penev
2026-03-19 17:15 ` Yazen Ghannam [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=20260319171537.GD1666212@yaz-khff2.amd.com \
    --to=yazen.ghannam@amd.com \
    --cc=bp@alien8.de \
    --cc=gustavoars@kernel.org \
    --cc=kees@kernel.org \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rosenp@gmail.com \
    --cc=tony.luck@intel.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox