RAS/AMD/FMPM: Fix off by one in error handling
PATCH 1/1 RAS/AMD/FMPM: Fix off by one in error handling
Decrement "i" before the first iteration. Depending on where this fails it could free something from one element beyond the end of the fru_records[] array.
Fixes 6f15e617cc99 ("RAS: Introduce a FRU memory poison manager")
Signed-off-by Dan Carpenter <[email protected]>
--- drivers/ras/amd/fmpm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ras/amd/fmpm.c +1 -1
@@ -817,7 +817,7 @@ static int allocate_records(void)return ret; out_free: -for (; i >=0 ; i--) +while (--i >=0 )kfree (fru_records[i]);kfree (fru_records);
Signature · 1 line
2.43.0
Quoted 16 lines · Dan Carpenter
Decrement "i" before the first iteration. Depending on where this fails it could free something from one element beyond the end of the fru_records[] array.
Fixes 6f15e617cc99 ("RAS: Introduce a FRU memory poison manager")Signed-off-by Dan Carpenter <[email protected]>--- drivers/ras/amd/fmpm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/ras/amd/fmpm.c +0
-0
drivers/ras/amd/fmpm.c static int allocate_records(void) · line 823
Quoted 8 lines
drivers/ras/amd/fmpm.c +1
-1@@ -817,7 +817,7 @@ static int allocate_records(void)return ret; out_free: -for (; i >=0 ; i--) +while (--i >=0 )kfree (fru_records[i]);kfree (fru_records);
Applied, thanks.
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette