Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit caabacf1 authored by Dan Carpenter's avatar Dan Carpenter Committed by Alok Chauhan
Browse files

ic3: master: off by one in mode_show()



This should be >= ARRAY_SIZE() to avoid reading one element beyond the
end of the array.

Change-Id: Ia26f48d55f98a989c1ce2f23893f80e7a651855a
Fixes: 3a379bbcea0a ("i3c: Add core I3C infrastructure")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Git-commit: afe120c777b7a6aa23b8c8a5fedae9201a7ced0c
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git


Signed-off-by: default avatarAlok Chauhan <alokc@codeaurora.org>
parent 0efb2961
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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