Skip to contentSkip to conversation

staging: spectra: don't read past array in Conv_Spare_Data_Log2Phy_Format()

PATCH New roel kluin 1 participant 1 message Jan 1, 2011 Staging

lore
Share & tools
lore

roel kluin

author
#0 lore raw

PATCH 1/1 staging: spectra: don't read past array in Conv_Spare_Data_Log2Phy_Format()

It should decrement or we read past the array

---
 drivers/staging/spectra/lld_nand.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/staging/spectra/lld_nand.c +1 -1
index 0d647a8..79d00e8 100644
@@ -1400,7 +1400,7 @@ void Conv_Spare_Data_Log2Phy_Format(u8 *data)
 	const u32 PageSpareSize  = DeviceInfo.wPageSpareSize;
 
 	if (enable_ecc) {
-		for (i = spareFlagBytes - 1; i >= 0; i++)
+		for (i = spareFlagBytes - 1; i >= 0; i--)
 			data[PageSpareSize - spareFlagBytes + i] = data[i];
 	}
 }