The first part of build_channel_array()identifies the number of enabled channels. Further down this count is used to allocate the ci_array. The next section parses the scan_elements directory again, and fills ci_array regardless if the channel is enabled or not. So if less than available channels are enabled ci_array memory is overflowed. This fix makes sure that we allocate enough memory. But the whole approach looks a bit cumbersome to me. Why not allocate memory for MAX_CHANNLES, less say 64 (I never seen a part with more than that channels). And skip the first part entirely. Signed-off-by: Michael Hennerich <michael.hennerich@analog.com> Acked-by: Jonathan Cameron <jic23@cam.ac.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> |
||
---|---|---|
.. | ||
dac | ||
device.txt | ||
generic_buffer.c | ||
iio_utils.h | ||
overview.txt | ||
ring.txt | ||
sysfs-bus-iio | ||
sysfs-bus-iio-dds | ||
sysfs-bus-iio-light | ||
sysfs-bus-iio-trigger-sysfs | ||
trigger.txt | ||
userspace.txt |