From: roel kluin Date: Mon, 3 Jan 2011 19:59:14 +0000 (-0800) Subject: staging: spectra: don't read past array in Conv_Spare_Data_Log2Phy_Format() X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=aa96646daa15d6ac05addc7db7272dd5787c6953;p=linux-beck.git staging: spectra: don't read past array in Conv_Spare_Data_Log2Phy_Format() It should decrement or we read past the array Signed-off-by: Roel Kluin Cc: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/spectra/lld_nand.c b/drivers/staging/spectra/lld_nand.c index 2263d3ea5456..0be7adc96b8c 100644 --- a/drivers/staging/spectra/lld_nand.c +++ b/drivers/staging/spectra/lld_nand.c @@ -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]; } }