[U-Boot] [PATCH] mmc: fix off-by-one bug in mmc_startup_v4()
Jaehoon Chung
jh80.chung at samsung.com
Wed Feb 21 06:37:59 UTC 2018
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 at 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]];
>
More information about the U-Boot
mailing list