Skip to content

Commit 6be7570

Browse files
committed
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 <[email protected]>
1 parent 4d034f8 commit 6be7570

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ports/nrf/modules/nrf/flashbdev.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ mp_obj_t nrf_flashbdev_writeblocks(size_t n_args, const mp_obj_t *args) {
8080
nrf_flash_obj_t *self = MP_OBJ_TO_PTR(args[0]);
8181
uint32_t block_num = mp_obj_get_int(args[1]);
8282
mp_buffer_info_t bufinfo;
83-
mp_get_buffer_raise(args[2], &bufinfo, MP_BUFFER_WRITE);
83+
mp_get_buffer_raise(args[2], &bufinfo, MP_BUFFER_READ);
8484

8585
mp_int_t address = self->start + (block_num * FLASH_PAGESIZE);
8686

0 commit comments

Comments
 (0)