vrahane commented on code in PR #3382:
URL: https://github.com/apache/mynewt-core/pull/3382#discussion_r1994152321
##########
fs/fcb/src/fcb.c:
##########
@@ -257,14 +286,21 @@ fcb_offset_last_n(struct fcb *fcb, uint8_t entries,
int
fcb_clear(struct fcb *fcb)
{
- int rc;
+ int rc = 0;
+
+ rc = os_mutex_pend(&fcb->f_mtx, OS_WAIT_FOREVER);
+ if (rc && rc != OS_NOT_STARTED) {
+ return FCB_ERR_ARGS;
+ }
- rc = 0;
while (!fcb_is_empty(fcb)) {
Review Comment:
While I understand what you mean for `fcb_is_empty()` but for
`fcb_free_sector_cnt()` the `fcb_getnext_area()` gets called which is already a
nolock version. There was no protection for it at all.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]