[U-Boot] [PATCH] mmc: fix off-by-one bug in mmc_startup_v4()

SD-card with EXT_CSD_REV value 9 will trigger off-by-one bug while accessing mmc_versions array. The patch fix that.
Signed-off-by: Alexander Kochetkov al.kochet@gmail.com --- drivers/mmc/mmc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index 99e2a75..3aa153a 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -1974,7 +1974,7 @@ static int mmc_startup_v4(struct mmc *mmc) return -ENOMEM; memcpy(mmc->ext_csd, ext_csd, MMC_MAX_BLOCK_LEN);
- if (ext_csd[EXT_CSD_REV] > ARRAY_SIZE(mmc_versions)) + if (ext_csd[EXT_CSD_REV] >= ARRAY_SIZE(mmc_versions)) return -EINVAL;
mmc->version = mmc_versions[ext_csd[EXT_CSD_REV]];

On 02/20/2018 08:35 PM, Alexander Kochetkov wrote:
SD-card with EXT_CSD_REV value 9 will trigger off-by-one bug while accessing mmc_versions array. The patch fix that.
I'm confusing about commit-msg. "SD-card with EXT_CSD_REV"?
Best Regards, Jaehoon Chung
Signed-off-by: Alexander Kochetkov al.kochet@gmail.com
drivers/mmc/mmc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index 99e2a75..3aa153a 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -1974,7 +1974,7 @@ static int mmc_startup_v4(struct mmc *mmc) return -ENOMEM; memcpy(mmc->ext_csd, ext_csd, MMC_MAX_BLOCK_LEN);
- if (ext_csd[EXT_CSD_REV] > ARRAY_SIZE(mmc_versions))
if (ext_csd[EXT_CSD_REV] >= ARRAY_SIZE(mmc_versions)) return -EINVAL;
mmc->version = mmc_versions[ext_csd[EXT_CSD_REV]];

21 февр. 2018 г., в 9:37, Jaehoon Chung jh80.chung@samsung.com написал(а):
I'm confusing about commit-msg. "SD-card with EXT_CSD_REV"?
Best Regards, Jaehoon Chung
I glad to write better, but don’t know. Would this one better?
In future, SD-cards with revision 9 (with REV value 9 inside EXT_CSD register) will trigger off-by-one bug while accessing mmc_versions array.
Regards, Alexander.

Hi,
On 02/21/2018 05:03 PM, Alexander Kochetkov wrote:
21 февр. 2018 г., в 9:37, Jaehoon Chung jh80.chung@samsung.com написал(а):
I'm confusing about commit-msg. "SD-card with EXT_CSD_REV"?
Best Regards, Jaehoon Chung
I glad to write better, but don’t know. Would this one better?
In future, SD-cards with revision 9 (with REV value 9 inside EXT_CSD register)
Do you mean SD-card or MMC-card? :) SD doesn't have EXT_CSD register.
- Removed Pantelis's mail account. Instead, add my account, plz.
Best Regards, Jaehoon Chung
will trigger off-by-one bug while accessing mmc_versions array.
Regards, Alexander.

Do you mean SD-card or MMC-card? :) SD doesn't have EXT_CSD register.
I see now. MMC-card. So, send v2? or you can simple fix SD with MMC in commit msg.
- Removed Pantelis's mail account. Instead, add my account, plz.
I took it from here: https://www.denx.de/wiki/U-Boot/Custodians
Regards, Alexander.

Hi Alexander,
On 02/21/2018 05:44 PM, Alexander Kochetkov wrote:
Do you mean SD-card or MMC-card? :) SD doesn't have EXT_CSD register.
I see now. MMC-card. So, send v2? or you can simple fix SD with MMC in commit msg.
If you're ok, i will apply yours after changing commit-msg.
Best Regards, Jaehoon Chung
- Removed Pantelis's mail account. Instead, add my account, plz.
I took it from here: https://www.denx.de/wiki/U-Boot/Custodians
Regards, Alexander.

On 02/21/2018 05:57 PM, Jaehoon Chung wrote:
Hi Alexander,
On 02/21/2018 05:44 PM, Alexander Kochetkov wrote:
Do you mean SD-card or MMC-card? :) SD doesn't have EXT_CSD register.
I see now. MMC-card. So, send v2? or you can simple fix SD with MMC in commit msg.
If you're ok, i will apply yours after changing commit-msg.
Applied to u-boot-mmc.
Best Regards, Jaehoon Chung
Best Regards, Jaehoon Chung
- Removed Pantelis's mail account. Instead, add my account, plz.
I took it from here: https://www.denx.de/wiki/U-Boot/Custodians
Regards, Alexander.
U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
participants (2)
-
Alexander Kochetkov
-
Jaehoon Chung