Skip to content

Commit d2ccfa1

Browse files
tomchycarlescufi
authored andcommitted
suit: Fix reading uninitialized IPUC
Returning valid data on uninitialized IPUC is misleading for the cache pool implementation. It may result in a strange cycle, where device assumes that some payloads are downloded, but once a missing one is fetched, they are erased. At this point, manifest logic may assume that all required payloads are fetched, but in fact the update will be rejected, leading to unnecesary confusion. The drawback of returning 0xFF is that after a reboot the device will always see the cache as empty. Ref: NCSDK-NONE Signed-off-by: Tomasz Chyrowicz <[email protected]>
1 parent 2fcf335 commit d2ccfa1

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

drivers/flash/flash_ipuc/flash_ipuc.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,11 @@ static int nrf_ipuc_read(const struct device *dev, off_t offset, void *data, siz
233233
return -ENOMEM;
234234
}
235235

236-
memcpy(data, (void *)(ctx->address + offset), len);
236+
if (ctx->setup_pending) {
237+
memset(data, 0xFF, len);
238+
} else {
239+
memcpy(data, (void *)(ctx->address + offset), len);
240+
}
237241

238242
return 0;
239243
}

0 commit comments

Comments
 (0)