From 267d8cc223b289fdd36f199dc0ff06ef7262913d Mon Sep 17 00:00:00 2001 From: Stephan Brunner Date: Mon, 17 Feb 2020 20:57:36 +0100 Subject: [PATCH] Preserve original size as it is modified inside the handler function. The value is const reference bound inside do_paged and must not be modified, it is used inside the paging loop. --- .../storage/blockdevice/COMPONENT_I2CEE/I2CEEBlockDevice.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/storage/blockdevice/COMPONENT_I2CEE/I2CEEBlockDevice.cpp b/components/storage/blockdevice/COMPONENT_I2CEE/I2CEEBlockDevice.cpp index df3854e7de..e544cd7358 100644 --- a/components/storage/blockdevice/COMPONENT_I2CEE/I2CEEBlockDevice.cpp +++ b/components/storage/blockdevice/COMPONENT_I2CEE/I2CEEBlockDevice.cpp @@ -160,7 +160,8 @@ int I2CEEBlockDevice::program(const void *buffer, bd_addr_t addr, bd_size_t size return BD_ERROR_OK; }; - return do_paged(addr, size, handler); + auto const originalSize = size; + return do_paged(addr, originalSize, handler); } int I2CEEBlockDevice::erase(bd_addr_t addr, bd_size_t size)