public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] iio: adc: ad7124: Implement input validation
@ 2024-11-08 18:18 Uwe Kleine-König
  2024-11-08 18:18 ` [PATCH 1/2] iio: adc: ad7124: Don't create more channels than the hardware is capable of Uwe Kleine-König
  2024-11-08 18:18 ` [PATCH 2/2] iio: adc: ad7124: Refuse invalid input specifiers Uwe Kleine-König
  0 siblings, 2 replies; 12+ messages in thread
From: Uwe Kleine-König @ 2024-11-08 18:18 UTC (permalink / raw)
  To: Lars-Peter Clausen, Michael Hennerich, Jonathan Cameron
  Cc: Mircea Caprioru, linux-iio, linux-kernel

Hello,

here come two commits that add some input validation of the number of
channels and the diff-inputs property values. The first limits the
number of iio channels to 16 which is the number of channel registers
for both hardware variants and so is the maximal number of (logical)
channels. The second commit refuses invalid channel numbers, that is
8-15 for ad7124-4 and values bigger than 31. The initial driver refused
all input specifiers > 15, but this limitation was lifted by commit
f1794fd7bdf7 ("iio: adc: ad7124: Remove input number limitation") with
the intention to allow values 16-31 but dropped all checks.

Note that at least some of the input specifiers in the 16-31 range are
different and using these yields bogus properties. E.g. 16 and 17 are
for temperature measurement, while using these in the device tree
results in a voltage property and the respective scale and offset
properties are bogus. Still these were explicitly allowed in
f1794fd7bdf7, so I didn't refuse these.

These patches don't conflict with the other ad7124 patches I sent
before, at least git can apply the series in both possible orders.

Best regards
Uwe

Uwe Kleine-König (2):
  iio: adc: ad7124: Don't create more channels than the hardware is
    capable of
  iio: adc: ad7124: Refuse invalid input specifiers

 drivers/iio/adc/ad7124.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

base-commit: 9852d85ec9d492ebef56dc5f229416c925758edc
-- 
2.45.2


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2024-11-23 15:01 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-08 18:18 [PATCH 0/2] iio: adc: ad7124: Implement input validation Uwe Kleine-König
2024-11-08 18:18 ` [PATCH 1/2] iio: adc: ad7124: Don't create more channels than the hardware is capable of Uwe Kleine-König
2024-11-08 18:52   ` David Lechner
2024-11-11 12:08     ` Uwe Kleine-König
2024-11-11 14:21       ` David Lechner
2024-11-23 15:01         ` Jonathan Cameron
2024-11-11 10:37   ` Nuno Sá
2024-11-11 11:53     ` Uwe Kleine-König
2024-11-11 14:32       ` Nuno Sá
2024-11-08 18:18 ` [PATCH 2/2] iio: adc: ad7124: Refuse invalid input specifiers Uwe Kleine-König
2024-11-11  9:15   ` Dan Carpenter
2024-11-11 12:12     ` Uwe Kleine-König

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox