[PATCH 2/4] RAS/amd/fmpm: Clear new records bitmap before rollback

From: Rui Qi

Date: Fri Aug 21 2026 - 06:13:24 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. 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);
+
for_each_fru(i, rec) {
/* No need to update saved records that match the current record size. */
if (rec->hdr.record_length == max_rec_len)
--
2.20.1