trusty: add return value test for munmap() calls
Ensure the return value of munmap() is checked.
Bug: 361754857
Test: build.py
Change-Id: I3290651897431042bdaa578fcc4e67eb232a50e8
diff --git a/src/main.cpp b/src/main.cpp
index 54adda4..69ed3b9 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -170,7 +170,10 @@
return NO_ERROR;
err:
- munmap(shm_base, shm_len);
+ int rc1 = munmap(shm_base, shm_len);
+ if (rc1 != NO_ERROR) {
+ TLOGW("munmap() failed: %d\n", rc1);
+ }
return rc;
}
@@ -253,7 +256,10 @@
static void on_channel_cleanup(void* _ctx) {
struct chan_ctx* ctx = (struct chan_ctx*)_ctx;
/* Abort operation and free all resources. */
- munmap(ctx->shm_base, ctx->shm_len);
+ int rc = munmap(ctx->shm_base, ctx->shm_len);
+ if (rc != NO_ERROR) {
+ TLOGW("munmap() failed: %d\n", rc);
+ }
ctx->op->abort();
ctx->op.reset();
free(ctx);