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

From: Rui Qi

Date: Tue Aug 25 2026 - 23:54:01 EST


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;
--
2.20.1