Message ID | 20190314223130.31802-2-wsa+renesas@sang-engineering.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | mmc: renesas_sdhi: prevent overflow for max_req_size | expand |
On Thu, 14 Mar 2019 at 23:32, Wolfram Sang <wsa+renesas@sang-engineering.com> wrote: > > We will need it later for other calculations. > > Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Applied for next, thanks! Kind regards Uffe > --- > drivers/mmc/host/tmio_mmc.h | 2 ++ > drivers/mmc/host/tmio_mmc_core.c | 2 +- > 2 files changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h > index 2adb0d24360f..64e00d8f3a88 100644 > --- a/drivers/mmc/host/tmio_mmc.h > +++ b/drivers/mmc/host/tmio_mmc.h > @@ -105,6 +105,8 @@ > TMIO_STAT_CARD_REMOVE | TMIO_STAT_CARD_INSERT) > #define TMIO_MASK_IRQ (TMIO_MASK_READOP | TMIO_MASK_WRITEOP | TMIO_MASK_CMD) > > +#define TMIO_MAX_BLK_SIZE 512 > + > struct tmio_mmc_data; > struct tmio_mmc_host; > > diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c > index 595949f1f001..dfc15ce41191 100644 > --- a/drivers/mmc/host/tmio_mmc_core.c > +++ b/drivers/mmc/host/tmio_mmc_core.c > @@ -1186,7 +1186,7 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host) > mmc->caps |= MMC_CAP_4_BIT_DATA | pdata->capabilities; > mmc->caps2 |= pdata->capabilities2; > mmc->max_segs = pdata->max_segs ? : 32; > - mmc->max_blk_size = 512; > + mmc->max_blk_size = TMIO_MAX_BLK_SIZE; > mmc->max_blk_count = pdata->max_blk_count ? : > (PAGE_SIZE / mmc->max_blk_size) * mmc->max_segs; > mmc->max_req_size = mmc->max_blk_size * mmc->max_blk_count; > -- > 2.11.0 >
diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h index 2adb0d24360f..64e00d8f3a88 100644 --- a/drivers/mmc/host/tmio_mmc.h +++ b/drivers/mmc/host/tmio_mmc.h @@ -105,6 +105,8 @@ TMIO_STAT_CARD_REMOVE | TMIO_STAT_CARD_INSERT) #define TMIO_MASK_IRQ (TMIO_MASK_READOP | TMIO_MASK_WRITEOP | TMIO_MASK_CMD) +#define TMIO_MAX_BLK_SIZE 512 + struct tmio_mmc_data; struct tmio_mmc_host; diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c index 595949f1f001..dfc15ce41191 100644 --- a/drivers/mmc/host/tmio_mmc_core.c +++ b/drivers/mmc/host/tmio_mmc_core.c @@ -1186,7 +1186,7 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host) mmc->caps |= MMC_CAP_4_BIT_DATA | pdata->capabilities; mmc->caps2 |= pdata->capabilities2; mmc->max_segs = pdata->max_segs ? : 32; - mmc->max_blk_size = 512; + mmc->max_blk_size = TMIO_MAX_BLK_SIZE; mmc->max_blk_count = pdata->max_blk_count ? : (PAGE_SIZE / mmc->max_blk_size) * mmc->max_segs; mmc->max_req_size = mmc->max_blk_size * mmc->max_blk_count;
We will need it later for other calculations. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> --- drivers/mmc/host/tmio_mmc.h | 2 ++ drivers/mmc/host/tmio_mmc_core.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-)