Re: [PATCH 2/4] RAS/amd/fmpm: Clear new records bitmap before rollback
From: Yazen Ghannam
Date: Tue Aug 25 2026 - 15:57:15 EST
On Fri, Aug 21, 2026 at 05:47:46PM +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. Clear the bitmap before it is used 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, 2 insertions(+)
>
> diff --git a/drivers/ras/amd/fmpm.c b/drivers/ras/amd/fmpm.c
> index 91c49080873e..0231163e2634 100644
> --- a/drivers/ras/amd/fmpm.c
> +++ b/drivers/ras/amd/fmpm.c
> @@ -533,6 +533,8 @@ static int save_new_records(void)
> unsigned int i;
> int ret = 0;
>
> + bitmap_zero(new_records, FMPM_MAX_NR_FRU);
> +
Rather than clear the bitmap, it can be initialized to zero.
DECLARE_BITMAP(new_records, FMPM_MAX_NR_FRU) = { 0 }
Thanks,
Yazen