summaryrefslogtreecommitdiffstats
path: root/drivers/i3c
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2018-11-23 08:15:05 +0100
committerBoris Brezillon <boris.brezillon@bootlin.com>2018-12-05 17:22:58 +0100
commitafe120c777b7a6aa23b8c8a5fedae9201a7ced0c (patch)
tree173cdf60443a7c93e508689e48ff624b6e283147 /drivers/i3c
parenti3c: fix an error code in i3c_master_add_i3c_dev_locked() (diff)
downloadlinux-afe120c777b7a6aa23b8c8a5fedae9201a7ced0c.tar.xz
linux-afe120c777b7a6aa23b8c8a5fedae9201a7ced0c.zip
ic3: off by one in mode_show()
This should be >= ARRAY_SIZE() to avoid reading one element beyond the end of the array. Fixes: 3a379bbcea0a ("i3c: Add core I3C infrastructure") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Diffstat (limited to 'drivers/i3c')
-rw-r--r--drivers/i3c/master.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c
index bda4b9613e53..c39f89d2deba 100644
--- a/drivers/i3c/master.c
+++ b/drivers/i3c/master.c
@@ -475,7 +475,7 @@ static ssize_t mode_show(struct device *dev,
i3c_bus_normaluse_lock(i3cbus);
if (i3cbus->mode < 0 ||
- i3cbus->mode > ARRAY_SIZE(i3c_bus_mode_strings) ||
+ i3cbus->mode >= ARRAY_SIZE(i3c_bus_mode_strings) ||
!i3c_bus_mode_strings[i3cbus->mode])
ret = sprintf(buf, "unknown\n");
else