trusty: add return value test for munmap() calls am: 29464e917d am: 00f0e3f2f7
Original change: https://android-review.googlesource.com/c/trusty/app/confirmationui/+/3239335
Change-Id: I08ae6df48ad2194d24cd2895553202bfc1dc15b7
Signed-off-by: Automerger Merge Worker <[email protected]>
diff --git a/src/main.cpp b/src/main.cpp
index 7c1ddec..a69f228 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);