summaryrefslogtreecommitdiff
path: root/drivers/mmc/host/dw_mmc-k3.c
diff options
context:
space:
mode:
authorShawn Lin <shawn.lin@rock-chips.com>2018-02-24 09:17:23 +0300
committerUlf Hansson <ulf.hansson@linaro.org>2018-02-27 17:12:25 +0300
commit0d84b9e5631d923744767dc6608672df906dd092 (patch)
tree7f732b668625b722255a00f1e8da4a20143e7274 /drivers/mmc/host/dw_mmc-k3.c
parenta4faa4929ed3be15e2d500d2405f992f6dedc8eb (diff)
downloadlinux-0d84b9e5631d923744767dc6608672df906dd092.tar.xz
mmc: dw_mmc: Fix out-of-bounds access for slot's caps
Add num_caps field for dw_mci_drv_data to validate the controller id from DT alias and non-DT ways. Reported-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com> Fixes: 800d78bfccb3 ("mmc: dw_mmc: add support for implementation specific callbacks") Cc: <stable@vger.kernel.org> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Diffstat (limited to 'drivers/mmc/host/dw_mmc-k3.c')
-rw-r--r--drivers/mmc/host/dw_mmc-k3.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/mmc/host/dw_mmc-k3.c b/drivers/mmc/host/dw_mmc-k3.c
index 75ae5803b0db..89cdb3d533bb 100644
--- a/drivers/mmc/host/dw_mmc-k3.c
+++ b/drivers/mmc/host/dw_mmc-k3.c
@@ -210,6 +210,7 @@ static int dw_mci_hi6220_execute_tuning(struct dw_mci_slot *slot, u32 opcode)
static const struct dw_mci_drv_data hi6220_data = {
.caps = dw_mci_hi6220_caps,
+ .num_caps = ARRAY_SIZE(dw_mci_hi6220_caps),
.switch_voltage = dw_mci_hi6220_switch_voltage,
.set_ios = dw_mci_hi6220_set_ios,
.parse_dt = dw_mci_hi6220_parse_dt,