Re: [PATCH v2 2/4] RAS/AMD/FMPM: Clear new records bitmap before rollback

From: Yazen Ghannam

Date: Thu Sep 24 2026 - 11:34:32 EST


On Wed, Aug 26, 2026 at 11:53:12AM +0800, Rui Qi wrote:
> save_new_records() uses a stack bitmap to track which ERST records were
> created during the current initialization pass. If a later write fails,
> the rollback path tests this bitmap to decide which records should be
> removed again.
>
> DECLARE_BITMAP() does not initialize stack storage, so the rollback path
> can observe stale bits and attempt to clear records that were not created
> by this function. Initialize the bitmap to zero at declaration so that
> only records successfully written in the current pass are rolled back.
>
> Fixes: 6f15e617cc99 ("RAS: Introduce a FRU memory poison manager")
> Signed-off-by: Rui Qi <qirui.001@xxxxxxxxxxxxx>
> ---
> drivers/ras/amd/fmpm.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/ras/amd/fmpm.c b/drivers/ras/amd/fmpm.c
> index 81d7f02c053d..e3f7bd053479 100644
> --- a/drivers/ras/amd/fmpm.c
> +++ b/drivers/ras/amd/fmpm.c
> @@ -528,7 +528,7 @@ static void set_rec_fields(struct fru_rec *rec)
>
> static int save_new_records(void)
> {
> - DECLARE_BITMAP(new_records, FMPM_MAX_NR_FRU);
> + DECLARE_BITMAP(new_records, FMPM_MAX_NR_FRU) = { 0 };
> struct fru_rec *rec;
> unsigned int i;
> int ret = 0;
> --

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

Thanks,
Yazen