Summary: - Patch 1: harden the consumers APIs to ensure read buffers are page aligned for attributes which could be formatted with sysfs_emit* helpers by the providers. Currently labels and ext_info attributes. - Patch 2: fix iio-mux consumer by switching from devm_kzalloc to kzalloc for the ext_info buffer. Tested with the iio-mux consumer driver alongside the pac1921 driver, which provides an ext_info attribute (the shunt resistor in this case). After applying patch-1, the error was detected during the iio-mux probe rather than in the pac1921 ext_info read callback. After applying patch-2, the error condition no longer occurred. Additionally, the extra check in iio_read_channel_label() was tested with the iio_hwmon consumer driver temporarily modified to allocate the buffer for retrieving provider labels using devm_kzalloc(PAGE_SIZE) instead of devm_get_free_pages(). The error was correctly detected during the iio_hwmon probe when attempting to retrieve pac1921 channel labels. [1]: https://lore.kernel.org/all/c486a1cf98a8b9ad093270543e8d2007@xxxxxxxxx Signed-off-by: Matteo Martelli <matteomartelli3@xxxxxxxxx> --- Matteo Martelli (2): iio: consumers: ensure read buffers for labels and ext_info are page aligned iio: iio-mux: kzalloc instead of devm_kzalloc to ensure page alignment drivers/iio/inkern.c | 11 +++++ drivers/iio/multiplexer/iio-mux.c | 84 +++++++++++++++++++++------------------ include/linux/iio/consumer.h | 4 +- 3 files changed, 59 insertions(+), 40 deletions(-) --- base-commit: 20fd1383cd616d61b2a79967da1221dc6cfb8430 change-id: 20241127-iio-kmalloc-align-ac7bfcfe5ec0 Best regards, -- Matteo Martelli <matteomartelli3@xxxxxxxxx>