From 6be7570219c05f5dd4a5e0bc10be3cff851da8c8 Mon Sep 17 00:00:00 2001 From: Damien George Date: Tue, 4 Mar 2025 10:48:55 +1100 Subject: [PATCH] nrf/modules: Fix access of read-only buffer in Flash.writeblocks. When writing to flash, the source buffer only needs to be read-only, not writable. This fix allows passing in `bytes` and other read-only buffer objects. Signed-off-by: Damien George --- ports/nrf/modules/nrf/flashbdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/nrf/modules/nrf/flashbdev.c b/ports/nrf/modules/nrf/flashbdev.c index e490dc53dd..41833b228e 100644 --- a/ports/nrf/modules/nrf/flashbdev.c +++ b/ports/nrf/modules/nrf/flashbdev.c @@ -80,7 +80,7 @@ mp_obj_t nrf_flashbdev_writeblocks(size_t n_args, const mp_obj_t *args) { nrf_flash_obj_t *self = MP_OBJ_TO_PTR(args[0]); uint32_t block_num = mp_obj_get_int(args[1]); mp_buffer_info_t bufinfo; - mp_get_buffer_raise(args[2], &bufinfo, MP_BUFFER_WRITE); + mp_get_buffer_raise(args[2], &bufinfo, MP_BUFFER_READ); mp_int_t address = self->start + (block_num * FLASH_PAGESIZE);