trusty:user:base: Fix mmap() return checks for NULL.
Bug: 268626780
Test: manual; build.py qemu-generic-arm64-test-debug
Change-Id: I8152472de66af900fe736588d0291bcf6415beec
diff --git a/app/acvp/acvp.cpp b/app/acvp/acvp.cpp
index b3ff7f3..4fb6876 100644
--- a/app/acvp/acvp.cpp
+++ b/app/acvp/acvp.cpp
@@ -218,7 +218,7 @@
shm_handle_ = shm;
arg_buffer_ = (uint8_t*)mmap(NULL, arg_buffer_size_, PROT_READ | PROT_WRITE,
0, shm_handle_, 0);
- if (!arg_buffer_) {
+ if (arg_buffer_ == MAP_FAILED) {
return false;
}
diff --git a/lib/spi/srv/tipc/tipc.c b/lib/spi/srv/tipc/tipc.c
index 7015191..a6f8f9f 100644
--- a/lib/spi/srv/tipc/tipc.c
+++ b/lib/spi/srv/tipc/tipc.c
@@ -125,7 +125,7 @@
shm_base = mmap(0, shm_req->len, MMAP_FLAG_PROT_READ | MMAP_FLAG_PROT_WRITE,
0, shm_handle, 0);
- if (!shm_base) {
+ if (shm_base == MAP_FAILED) {
TLOGE("failed to map shared memory\n");
rc = ERR_GENERIC;
goto err_mmap;