summaryrefslogtreecommitdiff
path: root/drivers/misc
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2018-12-03 17:52:19 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-02-15 10:10:11 +0300
commitdb5f65bfc1fab1de6044cd0fc30bb0aa68ed6373 (patch)
tree6748f39750ea4a2a8b34dc848af9d22864caab4c /drivers/misc
parent959e46afeca14b45a8d91006cf8dd59bb015493e (diff)
downloadlinux-db5f65bfc1fab1de6044cd0fc30bb0aa68ed6373.tar.xz
misc: vexpress: Off by one in vexpress_syscfg_exec()
commit f8a70d8b889f180e6860cb1f85fed43d37844c5a upstream. The > comparison should be >= to prevent reading beyond the end of the func->template[] array. (The func->template array is allocated in vexpress_syscfg_regmap_init() and it has func->num_templates elements.) Fixes: 974cc7b93441 ("mfd: vexpress: Define the device as MFD cells") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Sudeep Holla <sudeep.holla@arm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc')
-rw-r--r--drivers/misc/vexpress-syscfg.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/misc/vexpress-syscfg.c b/drivers/misc/vexpress-syscfg.c
index 6c3591cdf855..a3c6c773d9dc 100644
--- a/drivers/misc/vexpress-syscfg.c
+++ b/drivers/misc/vexpress-syscfg.c
@@ -61,7 +61,7 @@ static int vexpress_syscfg_exec(struct vexpress_syscfg_func *func,
int tries;
long timeout;
- if (WARN_ON(index > func->num_templates))
+ if (WARN_ON(index >= func->num_templates))
return -EINVAL;
command = readl(syscfg->base + SYS_CFGCTRL);