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 <[email protected]>

Thanks,
Yazen

Reply via email to