]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
i3c/master/mipi-i3c-hci: Fix a potentially infinite loop in 'hci_dat_v1_get_index()'
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Wed, 17 Nov 2021 22:05:23 +0000 (23:05 +0100)
committerPaolo Pisati <paolo.pisati@canonical.com>
Wed, 9 Mar 2022 14:17:46 +0000 (15:17 +0100)
commita08ee0fbb56b9b914f2fb9ddf76919bfb436d9f0
treefd2d2b0e317269c1d0d2fecf82cc2fc1237a27d3
parent4f8bf72135ec2c6edda7c762e9873fce8b58a956
i3c/master/mipi-i3c-hci: Fix a potentially infinite loop in 'hci_dat_v1_get_index()'

BugLink: https://bugs.launchpad.net/bugs/1964361
[ Upstream commit 3f43926f271287fb1744c9ac9ae1122497f2b0c2 ]

The code in 'hci_dat_v1_get_index()' really looks like a hand coded version
of 'for_each_set_bit()', except that a +1 is missing when searching for the
next set bit.

This really looks odd and it seems that it will loop until 'dat_w0_read()'
returns the expected result.

So use 'for_each_set_bit()' instead. It is less verbose and should be more
correct.

Fixes: 9ad9a52cce28 ("i3c/master: introduce the mipi-i3c-hci driver")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Acked-by: Nicolas Pitre <npitre@baylibre.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/0cdf3cb10293ead1acd271fdb8a70369c298c082.1637186628.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
drivers/i3c/master/mipi-i3c-hci/dat_v1.c