Re: [PATCH] nvmem: apple-spmi-nvmem: wrap regmap calls to satisfy CFI
From: Sven Peter
Date: Sun Nov 23 2025 - 16:46:11 EST
On 18.11.25 03:35, Jens Reidel wrote:
The Apple SPMI NVMEM driver previously cast regmap_bulk_read/write to
void * when assigning them to nvmem_config's reg_read/reg_write
function pointers.
This cast breaks the expected function signature of nvmem_reg_read_t
and nvmem_reg_write_t. With CFI enabled, indirect calls through
these pointers fail:
CFI failure at nvmem_reg_write+0x194/0x1e4 (target: regmap_bulk_write+0x0/0x2c8; expected type: 0x83a189c3)
...
Call trace:
nvmem_reg_write+0x194/0x1e4 (P)
__nvmem_cell_entry_write+0x298/0x2e8
nvmem_cell_write+0x24/0x34
macsmc_reboot_probe+0x1dc/0x454 [macsmc_reboot]
...
Introduce thin wrapper functions with the correct nvmem function
pointer types to satisfy the CFI checks.
Fixes: fe91c24a551c ("nvmem: Add apple-spmi-nvmem driver")
Signed-off-by: Jens Reidel <adrian@xxxxxxxxxxxxxx>
Reported-by: Clayton Craft <craftyguy@xxxxxxxxxxxxxxxx>
Tested-by: Clayton Craft <craftyguy@xxxxxxxxxxxxxxxx>
Cc: stable@xxxxxxxxxxxxxxx
---
Reviewed-by: Sven Peter <sven@xxxxxxxxxx>
Thanks,
Sven