[PATCH v5 2/8] nvmem: core: Enforce stride and alignment checks for nvmem_device functions

Thomas Weißschuh thomas.weissschuh at linutronix.de
Thu May 21 07:32:39 PDT 2026


On Wed, May 20, 2026 at 04:27:54PM +0200, Gregor Herburger wrote:
> The stride and word_size attributes in the nvmem_config struct are
> currently only used when reading/writing through sysfs functions
> bin_attr_nvmem_read/bin_attr_nvmem_write and in the nvmem_cell api.
> Reads and writes with nvmem_device_write/nvmem_device_read still allow
> unaligned access.
> 
> Add a check to these functions to enforce word_size and stride_length
> aligned reads and writes.
> 
> Signed-off-by: Gregor Herburger <gregor.herburger at linutronix.de>

Reviewed-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>

> ---
>  drivers/nvmem/core.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)

(...)



More information about the linux-arm-kernel mailing list