All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 0/1] Sanity check buffer callback
@ 2020-11-12 15:13 Nuno Sá
  2020-11-12 15:13 ` [RFC PATCH 1/1] iio: buffer: " Nuno Sá
  2020-11-14 16:33 ` [RFC PATCH 0/1] " Jonathan Cameron
  0 siblings, 2 replies; 6+ messages in thread
From: Nuno Sá @ 2020-11-12 15:13 UTC (permalink / raw)
  To: linux-iio; +Cc: Jonathan Cameron, Lars-Peter Clausen, Peter Meerwald-Stadler

When going through the code of the buffer-cb interface and all it's
users, I realized that the stm32_adfsdm driver is calling
`iio_channel_get_all_cb()` with NULL for the cb. After going a bit
trough the stm drivers, it looks like this is actually intentional.
However, it is clear that we have a clear/direct route here for a NULL
pointer dereference. I'm being lazy in this RFC and just doing a
sanity check in the `iio_buffer_cb_store_to()` so that we don't have to
change the stm driver... The point is just to bring this up and see if
we want to do something about this.

To be clear, the way I think this should go is just to return -EINVAL in
`iio_channel_get_all_cb()` if a NULL ptr is passed. Whats the point of a
buffer-cb if cb is NULL, right? This would naturally break the stm
driver, but I guess we could just define a dummy handler there that
would not be used (or could the HW consumer be an option here?)...

Thoughts?

Nuno Sá (1):
  iio: buffer: Sanity check buffer callback

 drivers/iio/buffer/industrialio-buffer-cb.c | 4 ++++
 1 file changed, 4 insertions(+)

-- 
2.29.2


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

end of thread, other threads:[~2020-11-16 16:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-12 15:13 [RFC PATCH 0/1] Sanity check buffer callback Nuno Sá
2020-11-12 15:13 ` [RFC PATCH 1/1] iio: buffer: " Nuno Sá
2020-11-12 16:15   ` Lars-Peter Clausen
2020-11-12 16:20     ` Lars-Peter Clausen
2020-11-14 16:33 ` [RFC PATCH 0/1] " Jonathan Cameron
2020-11-16 16:49   ` Olivier MOYSAN

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.