Skip to contentSkip to conversation

mmc: fix off-by-one bug in mmc_startup_v4()

PATCH New Alexander Kochetkov 2 participants 7 messages Feb 20, 2018 – Feb 23, 2018 MMC, SD and SDIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 drivers/mmc/mmc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/mmc.c +1 -1
index 99e2a75..3aa153a 100644
@@ -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]];
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/1 mmc: fix off-by-one bug in mmc_startup_v4()

Quoted 2 lines · Alexander Kochetkov

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

Quoted 20 lines
---
 drivers/mmc/mmc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/mmc.c +1 -1
index 99e2a75..3aa153a 100644
@@ -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]];
#2 lore raw

PATCH 1/1 mmc: fix off-by-one bug in mmc_startup_v4()

Quoted 7 lines

21 февр. 2018 г., в 9:37, Jaehoon Chung <[email protected]> написал(а):

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.

#3 lore raw

PATCH 1/1 mmc: fix off-by-one bug in mmc_startup_v4()

Hi,

Quoted 11 lines · Alexander Kochetkov
Quoted 7 lines

21 февр. 2018 г., в 9:37, Jaehoon Chung <[email protected]> написал(а):

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

Quoted 6 lines

will trigger off-by-one bug while accessing mmc_versions array.

Regards,
Alexander.

#4 lore raw

PATCH 1/1 mmc: fix off-by-one bug in mmc_startup_v4()

Quoted 3 lines

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.

Quoted 2 lines

- 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.

#5 lore raw

PATCH 1/1 mmc: fix off-by-one bug in mmc_startup_v4()

Hi Alexander,

Quoted 5 lines · Alexander Kochetkov
Quoted 3 lines

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

Quoted 13 lines
Quoted 3 lines

- 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.

#6 lore raw

PATCH 1/1 mmc: fix off-by-one bug in mmc_startup_v4()

Quoted 10 lines · Jaehoon Chung

Hi Alexander,

Quoted 5 lines · Alexander Kochetkov
Quoted 3 lines

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

Quoted 23 lines

Best Regards,
Jaehoon Chung

Quoted 13 lines
Quoted 3 lines

- 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 at lists.denx.de
https://lists.denx.de/listinfo/u-boot