mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
iio: add __counted_by_ptr attribute to channels in struct iio_dev
In 'struct iio_dev', the 'channels' pointer refers to an array of IIO
channel specifications ('struct iio_chan_spec const'), and the size of
this array is tracked by the 'num_channels' field within the same
struct.
Applying the '__counted_by_ptr' attribute to 'channels' allows KASAN
and compiler-based bounds checkers to verify that accesses to 'channels'
remain within bounds at runtime.
Cc: codemender-patching+linux@google.com
Assisted-by: LLM
Signed-off-by: Bill Wendling <morbo@google.com>
Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
This commit is contained in:
parent
525b772be2
commit
a1b8188791
|
|
@ -660,7 +660,7 @@ struct iio_dev {
|
|||
struct iio_poll_func *pollfunc;
|
||||
struct iio_poll_func *pollfunc_event;
|
||||
|
||||
struct iio_chan_spec const *channels;
|
||||
struct iio_chan_spec const *channels __counted_by_ptr(num_channels);
|
||||
int num_channels;
|
||||
|
||||
const char *name;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user