mirror of
https://github.com/AsahiLinux/u-boot
synced 2025-02-17 22:49:02 +00:00
mmc: fix off-by-one bug in mmc_startup_v4()
MMC 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>
This commit is contained in:
parent
8a856db238
commit
76584e3398
1 changed files with 1 additions and 1 deletions
|
@ -1969,7 +1969,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]];
|
||||
|
|
Loading…
Add table
Reference in a new issue