android_kernel_asus_sm8350/drivers/counter
Fabrice Gasnier 796fc331c3 counter: stm32-timer-cnt: fix ceiling write max value
commit e4c3e133294c0a292d21073899b05ebf530169bd upstream.

The ceiling value isn't checked before writing it into registers. The user
could write a value higher than the counter resolution (e.g. 16 or 32 bits
indicated by max_arr). This makes most significant bits to be truncated.
Fix it by checking the max_arr to report a range error [1] to the user.

[1] https://lkml.org/lkml/2021/2/12/358

Fixes: ad29937e20 ("counter: Add STM32 Timer quadrature encoder")
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Cc: <Stable@vger.kernel.org>
Link: https://lore.kernel.org/r/1614696235-24088-1-git-send-email-fabrice.gasnier@foss.st.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-24 11:26:43 +01:00
..
104-quad-8.c counter: 104-quad-8: Add lock guards - generic interface 2020-05-02 08:48:44 +02:00
counter.c
ftm-quaddec.c counter/ftm-quaddec: Use device-managed registration API 2019-07-27 22:55:27 +01:00
Kconfig Second set of IIO fixes for the 5.2 cycle. 2019-06-17 22:28:29 +02:00
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
stm32-lptimer-cnt.c counter: stm32-lptimer: add counter device 2019-04-25 21:33:41 +02:00
stm32-timer-cnt.c counter: stm32-timer-cnt: fix ceiling write max value 2021-03-24 11:26:43 +01:00