lib: trusty: Assert that at most one handle gets deleted `_hset_add_item` ensures that we cannot insert duplicates. This change asserts if `_hset_del_item` encounters duplicates. Test: build & run Trusty unit tests Bug: 382291660 Change-Id: I6d8375be46602d0b770acb6dcf99bf21aa16c46f
diff --git a/lib/trusty/uctx.c b/lib/trusty/uctx.c index b3a775f..abd6ed1 100644 --- a/lib/trusty/uctx.c +++ b/lib/trusty/uctx.c
@@ -732,6 +732,7 @@ free(ref); } } + ASSERT(del_cnt <= 1); return del_cnt ? NO_ERROR : ERR_NOT_FOUND; } @@ -751,6 +752,7 @@ handle_set_update_ref(ref, emask, cookie); } } + ASSERT(mod_cnt <= 1); return mod_cnt ? NO_ERROR : ERR_NOT_FOUND; }