feat: enable `-Wsign-compare`

This enables the `-Wsign-compare` warning everywhere except inside the
`ASSERT_EQ` macro, which will be fixed in later commits.

Change-Id: I485a0e909f23264c662702d996f792e9411ecd2c
Signed-off-by: Karl Meakin <karl.meakin@arm.com>
diff --git a/build/BUILD.gn b/build/BUILD.gn
index dda357a..5903877 100644
--- a/build/BUILD.gn
+++ b/build/BUILD.gn
@@ -14,7 +14,6 @@
 
     "-Wall",
     "-Wextra",
-    "-Wno-sign-compare",
     "-Wpedantic",
     "-Werror",
 
diff --git a/src/arch/aarch64/hypervisor/ffa.c b/src/arch/aarch64/hypervisor/ffa.c
index 07187e1..9c75a8f 100644
--- a/src/arch/aarch64/hypervisor/ffa.c
+++ b/src/arch/aarch64/hypervisor/ffa.c
@@ -44,7 +44,7 @@
 
 	if (ret.func == FFA_SUCCESS_32) {
 		spmc_id = ret.arg2;
-	} else if (ret.func == SMCCC_ERROR_UNKNOWN ||
+	} else if (ret.func == (uint64_t)SMCCC_ERROR_UNKNOWN ||
 		   (ret.func == FFA_ERROR_32 &&
 		    ffa_error_code(ret) == FFA_NOT_SUPPORTED)) {
 		spmc_id = HF_SPMC_VM_ID;
diff --git a/src/arch/aarch64/hypervisor/psci_handler.c b/src/arch/aarch64/hypervisor/psci_handler.c
index b1e1843..3532998 100644
--- a/src/arch/aarch64/hypervisor/psci_handler.c
+++ b/src/arch/aarch64/hypervisor/psci_handler.c
@@ -183,7 +183,7 @@
 					(uintreg_t)&cpu_entry, (uintreg_t)c, 0,
 					0, 0, SMCCC_CALLER_HYPERVISOR);
 			*ret = smc_res.func;
-		} while (*ret == PSCI_ERROR_ALREADY_ON);
+		} while (*ret == (uintreg_t)PSCI_ERROR_ALREADY_ON);
 
 		if (*ret != PSCI_RETURN_SUCCESS) {
 			cpu_off(c);
diff --git a/src/arch/aarch64/plat/ffa/hypervisor.c b/src/arch/aarch64/plat/ffa/hypervisor.c
index 3c7db40..3808923 100644
--- a/src/arch/aarch64/plat/ffa/hypervisor.c
+++ b/src/arch/aarch64/plat/ffa/hypervisor.c
@@ -786,7 +786,7 @@
 		(struct ffa_value){.func = FFA_RXTX_UNMAP_32,
 				   .arg1 = id << FFA_RXTX_ALLOCATOR_SHIFT});
 	func = ret.func & ~SMCCC_CONVENTION_MASK;
-	if (ret.func == SMCCC_ERROR_UNKNOWN) {
+	if (ret.func == (uint64_t)SMCCC_ERROR_UNKNOWN) {
 		panic("Unknown error forwarding RXTX_UNMAP.\n");
 	} else if (func == FFA_ERROR_32) {
 		panic("Error %d forwarding RX/TX buffers.\n", ret.arg2);
diff --git a/src/arch/aarch64/plat/ffa/spmc.c b/src/arch/aarch64/plat/ffa/spmc.c
index f2a7b7b..b5a76d2 100644
--- a/src/arch/aarch64/plat/ffa/spmc.c
+++ b/src/arch/aarch64/plat/ffa/spmc.c
@@ -2893,7 +2893,7 @@
 	current_locked = vcpu_lock(current);
 	rt_model = current_locked.vcpu->rt_model;
 
-	if (error_code == FFA_ABORTED && rt_model == RTM_SP_INIT) {
+	if (error_code == (uint32_t)FFA_ABORTED && rt_model == RTM_SP_INIT) {
 		dlog_error("Aborting SP %#x from vCPU %u\n", current->vm->id,
 			   vcpu_index(current));
 
diff --git a/src/arch/aarch64/smc.h b/src/arch/aarch64/smc.h
index 14bb9c7..ab243c9 100644
--- a/src/arch/aarch64/smc.h
+++ b/src/arch/aarch64/smc.h
@@ -46,7 +46,7 @@
  * TODO: Trusted OS call: 0x32000000 - 0x3f000000
  */
 
-#define SMCCC_ERROR_UNKNOWN  (-1)
+#define SMCCC_ERROR_UNKNOWN (-1)
 
 #define SMCCC_VERSION_FUNC_ID	0x80000000
 #define SMCCC_VERSION_1_2	0x10002
diff --git a/src/ffa_memory.c b/src/ffa_memory.c
index aa15bb9..d188f3d 100644
--- a/src/ffa_memory.c
+++ b/src/ffa_memory.c
@@ -614,7 +614,7 @@
 		}
 	}
 
-	for (int i = 0; i < memory_region->receiver_count; i++) {
+	for (size_t i = 0; i < memory_region->receiver_count; i++) {
 		uint32_t composite_offset;
 
 		if (ffa_version == MAKE_FFA_VERSION(1, 0)) {
diff --git a/src/manifest.c b/src/manifest.c
index 92afa7b..b317fc8 100644
--- a/src/manifest.c
+++ b/src/manifest.c
@@ -1122,7 +1122,7 @@
 	}
 
 	/* GP register is restricted to one of x0 - x3. */
-	if (vm->partition.gp_register_num != -1 &&
+	if (vm->partition.gp_register_num != DEFAULT_BOOT_GP_REGISTER &&
 	    vm->partition.gp_register_num > 3) {
 		dlog_error("GP register number %s: %u\n", error_string,
 			   vm->partition.gp_register_num);
diff --git a/src/mpool.c b/src/mpool.c
index 0ee7cb8..ed40e6e 100644
--- a/src/mpool.c
+++ b/src/mpool.c
@@ -159,7 +159,8 @@
 	new_end = (void *)align_down((char *)begin + size, p->entry_size);
 
 	/* Nothing to do if there isn't enough room for an entry. */
-	if (new_begin >= new_end || new_end - new_begin < p->entry_size) {
+	if (new_begin >= new_end ||
+	    (size_t)(new_end - new_begin) < p->entry_size) {
 		return false;
 	}
 
@@ -302,7 +303,7 @@
 			 * Add back the space consumed by the alignment
 			 * requirement, if it's big enough to fit an entry.
 			 */
-			if (start - (char *)chunk >= p->entry_size) {
+			if ((size_t)(start - (char *)chunk) >= p->entry_size) {
 				chunk->next_chunk = *prev;
 				*prev = chunk;
 				chunk->limit = (struct mpool_chunk *)start;
diff --git a/test/arch/aarch64/tee_test.c b/test/arch/aarch64/tee_test.c
index d839b4b..3656610 100644
--- a/test/arch/aarch64/tee_test.c
+++ b/test/arch/aarch64/tee_test.c
@@ -36,7 +36,7 @@
 	 * TODO(qwandor): Remove this UNKNOWN check once we have a build of TF-A
 	 * which supports FF-A memory sharing.
 	 */
-	if (ret.func != SMCCC_ERROR_UNKNOWN) {
+	if ((int64_t)ret.func != SMCCC_ERROR_UNKNOWN) {
 		ASSERT_EQ(func, FFA_SUCCESS_32);
 	}
 }
diff --git a/test/inc/test/hftest_impl.h b/test/inc/test/hftest_impl.h
index e11b4eb..458eea1 100644
--- a/test/inc/test/hftest_impl.h
+++ b/test/inc/test/hftest_impl.h
@@ -237,6 +237,8 @@
 
 #define HFTEST_ASSERT_OP(lhs, rhs, op, fatal)                              \
 	do {                                                               \
+		_Pragma("clang diagnostic push");                          \
+		_Pragma("clang diagnostic ignored \"-Wsign-compare\"");    \
 		__typeof(lhs) lhs_value = lhs;                             \
 		__typeof(rhs) rhs_value = rhs;                             \
 		if (!(lhs_value op rhs_value)) {                           \
@@ -248,6 +250,7 @@
 				ctx->abort();                              \
 			}                                                  \
 		}                                                          \
+		_Pragma("clang diagnostic pop");                           \
 	} while (0)
 
 #define HFTEST_FAIL(fatal, ...)                                        \
diff --git a/test/vmapi/arch/aarch64/gicv3/timer_secondary.c b/test/vmapi/arch/aarch64/gicv3/timer_secondary.c
index 9eace3d..66a4bb2 100644
--- a/test/vmapi/arch/aarch64/gicv3/timer_secondary.c
+++ b/test/vmapi/arch/aarch64/gicv3/timer_secondary.c
@@ -284,7 +284,7 @@
 	 * Let the secondary handle the message and set the timer.
 	 */
 	last_interrupt_id = 0;
-	for (int i = 0; i < 20; ++i) {
+	for (size_t i = 0; i < 20; ++i) {
 		ret = ffa_run(SERVICE_VM1, 0);
 		EXPECT_EQ(ret.func, HF_FFA_RUN_WAIT_FOR_INTERRUPT);
 		dlog("Primary looping until timer fires; %d ns "
diff --git a/test/vmapi/arch/aarch64/smc_whitelist.c b/test/vmapi/arch/aarch64/smc_whitelist.c
index 30d0f3c..f9a5088 100644
--- a/test/vmapi/arch/aarch64/smc_whitelist.c
+++ b/test/vmapi/arch/aarch64/smc_whitelist.c
@@ -19,7 +19,7 @@
 		0x3333333333333333, 0x4444444444444444, 0x5555555555555555,
 		0x6666666666666666, 0x77777777);
 
-	EXPECT_EQ(smc_res.func, SMCCC_ERROR_UNKNOWN);
+	EXPECT_EQ((int64_t)smc_res.func, SMCCC_ERROR_UNKNOWN);
 	EXPECT_EQ(smc_res.arg1, UINT64_C(0x1111111111111111));
 	EXPECT_EQ(smc_res.arg2, UINT64_C(0x2222222222222222));
 	EXPECT_EQ(smc_res.arg3, UINT64_C(0x3333333333333333));
diff --git a/test/vmapi/ffa_secure_partitions/services/arch/aarch64/secure/inc/partition_services.h b/test/vmapi/ffa_secure_partitions/services/arch/aarch64/secure/inc/partition_services.h
index 631fdb2..abf09da 100644
--- a/test/vmapi/ffa_secure_partitions/services/arch/aarch64/secure/inc/partition_services.h
+++ b/test/vmapi/ffa_secure_partitions/services/arch/aarch64/secure/inc/partition_services.h
@@ -50,9 +50,9 @@
 	return (int)res.arg3;
 }
 
-static inline int sp_resp_value(struct ffa_value res)
+static inline uint32_t sp_resp_value(struct ffa_value res)
 {
-	return (int)res.arg4;
+	return res.arg4;
 }
 
 enum sp_cmd {
diff --git a/test/vmapi/ffa_secure_partitions/services/arch/aarch64/secure/partition_services.c b/test/vmapi/ffa_secure_partitions/services/arch/aarch64/secure/partition_services.c
index 02031a6..e432cc8 100644
--- a/test/vmapi/ffa_secure_partitions/services/arch/aarch64/secure/partition_services.c
+++ b/test/vmapi/ffa_secure_partitions/services/arch/aarch64/secure/partition_services.c
@@ -113,7 +113,7 @@
 	 */
 	res = smc32(0x82000100, espi_id, 0, 0, 0, 0, 0, 0);
 
-	if (res.func == SMCCC_ERROR_UNKNOWN) {
+	if ((int64_t)res.func == SMCCC_ERROR_UNKNOWN) {
 		HFTEST_LOG("SiP SMC call not supported");
 		sp_error(own_id, source, 0);
 	}
diff --git a/test/vmapi/ffa_secure_partitions/services/arch/aarch64/secure/secure_interrupts.c b/test/vmapi/ffa_secure_partitions/services/arch/aarch64/secure/secure_interrupts.c
index 9c8b718..45debf2 100644
--- a/test/vmapi/ffa_secure_partitions/services/arch/aarch64/secure/secure_interrupts.c
+++ b/test/vmapi/ffa_secure_partitions/services/arch/aarch64/secure/secure_interrupts.c
@@ -161,12 +161,11 @@
 		return false;
 	}
 
-	if (sp_resp_value(ret) != expected_resp || (uint32_t)ret.arg4 != arg) {
+	if (sp_resp_value(ret) != expected_resp || ret.arg4 != arg) {
 		HFTEST_LOG(
 			"Expected response %x and %x; "
 			"Obtained %x and %x",
-			expected_resp, arg, sp_resp_value(ret),
-			(int32_t)ret.arg4);
+			expected_resp, arg, sp_resp_value(ret), ret.arg4);
 		return false;
 	}
 
diff --git a/test/vmapi/primary_with_secondaries/memory_sharing.c b/test/vmapi/primary_with_secondaries/memory_sharing.c
index 3914daa..711514c 100644
--- a/test/vmapi/primary_with_secondaries/memory_sharing.c
+++ b/test/vmapi/primary_with_secondaries/memory_sharing.c
@@ -33,7 +33,7 @@
 	struct mailbox_buffers mb,
 	struct ffa_value (*send_function)(uint32_t, uint32_t),
 	struct ffa_memory_region_constituent constituents[],
-	int constituent_count, int32_t avoid_vm)
+	int constituent_count, uint32_t avoid_vm)
 {
 	enum ffa_data_access data_access[] = {
 		FFA_DATA_ACCESS_NOT_SPECIFIED, FFA_DATA_ACCESS_RO,
@@ -180,7 +180,7 @@
 static void check_cannot_donate_memory(
 	struct mailbox_buffers mb,
 	struct ffa_memory_region_constituent constituents[],
-	int constituent_count, int32_t avoid_vm)
+	int constituent_count, uint32_t avoid_vm)
 {
 	struct ffa_partition_info *service1_info = service1(mb.recv);
 	struct ffa_partition_info *service2_info = service2(mb.recv);
@@ -515,7 +515,7 @@
 
 	EXPECT_EQ(ffa_run(service1_info->vm_id, 0).func, FFA_YIELD_32);
 
-	for (int i = 0; i < PAGE_SIZE; ++i) {
+	for (size_t i = 0; i < PAGE_SIZE; ++i) {
 		EXPECT_EQ(pages[i], 'b');
 	}
 }
@@ -550,14 +550,14 @@
 	run_res = ffa_run(service1_info->vm_id, 0);
 	EXPECT_EQ(run_res.func, FFA_YIELD_32);
 
-	for (int i = 0; i < PAGE_SIZE; ++i) {
+	for (size_t i = 0; i < PAGE_SIZE; ++i) {
 		pages[i] = i;
 	}
 
 	run_res = ffa_run(service1_info->vm_id, 0);
 	EXPECT_EQ(run_res.func, FFA_YIELD_32);
 
-	for (int i = 0; i < PAGE_SIZE; ++i) {
+	for (size_t i = 0; i < PAGE_SIZE; ++i) {
 		uint8_t value = i + 1;
 
 		EXPECT_EQ(pages[i], value);
@@ -598,7 +598,7 @@
 	run_res = ffa_run(service1_info->vm_id, 0);
 	EXPECT_EQ(run_res.func, FFA_YIELD_32);
 	EXPECT_EQ(ffa_mem_reclaim(handle, 0).func, FFA_SUCCESS_32);
-	for (int i = 0; i < PAGE_SIZE; ++i) {
+	for (size_t i = 0; i < PAGE_SIZE; ++i) {
 		ASSERT_EQ(ptr[i], 'c');
 	}
 
@@ -665,7 +665,7 @@
 	EXPECT_EQ(run_res.func, FFA_YIELD_32);
 	EXPECT_EQ(ffa_mem_reclaim(handle, 0).func, FFA_SUCCESS_32);
 	/* Ensure that the secondary VM accessed the region. */
-	for (int i = 0; i < PAGE_SIZE; ++i) {
+	for (size_t i = 0; i < PAGE_SIZE; ++i) {
 		ASSERT_EQ(ptr[i], 'c');
 	}
 
@@ -716,7 +716,7 @@
 	EXPECT_EQ(ffa_mem_reclaim(handle, 0).func, FFA_SUCCESS_32);
 
 	/* Ensure that the secondary VM accessed the region. */
-	for (int i = 0; i < PAGE_SIZE * FRAGMENTED_SHARE_PAGE_COUNT; ++i) {
+	for (size_t i = 0; i < PAGE_SIZE * FRAGMENTED_SHARE_PAGE_COUNT; ++i) {
 		ASSERT_EQ(ptr[i], 'c');
 	}
 
@@ -758,7 +758,7 @@
 	EXPECT_EQ(run_res.func, FFA_YIELD_32);
 	EXPECT_EQ(ffa_mem_reclaim(handle, 0).func, FFA_SUCCESS_32);
 	/* Ensure that the secondary VM accessed the region. */
-	for (int i = 0; i < PAGE_SIZE; ++i) {
+	for (size_t i = 0; i < PAGE_SIZE; ++i) {
 		ASSERT_EQ(ptr[i], 'c');
 	}
 
@@ -842,7 +842,7 @@
 					       HF_MAILBOX_SIZE),
 		  service1_info->vm_id);
 
-	for (int i = 0; i < PAGE_SIZE; ++i) {
+	for (size_t i = 0; i < PAGE_SIZE; ++i) {
 		ASSERT_EQ(ptr[i], 'c');
 	}
 
@@ -886,7 +886,7 @@
 
 	EXPECT_EQ(ffa_mem_reclaim(handle, 0).func, FFA_SUCCESS_32);
 
-	for (int i = 0; i < PAGE_SIZE; ++i) {
+	for (size_t i = 0; i < PAGE_SIZE; ++i) {
 		ASSERT_EQ(ptr[i], 'd');
 	}
 
@@ -1018,7 +1018,7 @@
 	composite = ffa_memory_region_get_composite(memory_region, 0);
 	// NOLINTNEXTLINE(performance-no-int-to-ptr)
 	ptr = (uint8_t *)composite->constituents[0].address;
-	for (int i = 0; i < PAGE_SIZE; ++i) {
+	for (size_t i = 0; i < PAGE_SIZE; ++i) {
 		ASSERT_EQ(ptr[i], 0);
 	}
 
@@ -1058,7 +1058,7 @@
 	composite = ffa_memory_region_get_composite(memory_region, 0);
 	// NOLINTNEXTLINE(performance-no-int-to-ptr)
 	ptr = (uint8_t *)composite->constituents[0].address;
-	for (int i = 0; i < PAGE_SIZE; ++i) {
+	for (size_t i = 0; i < PAGE_SIZE; ++i) {
 		ASSERT_EQ(ptr[i], 0);
 	}
 
@@ -1664,7 +1664,7 @@
 	SERVICE_SELECT(service1_info->vm_id, "ffa_memory_return", mb.send);
 
 	/* Check for unaligned pages for either constituent. */
-	for (int i = 0; i < PAGE_SIZE; i++) {
+	for (size_t i = 0; i < PAGE_SIZE; i++) {
 		for (int j = 0; i < PAGE_SIZE; i++) {
 			/* Skip the case they're both aligned. */
 			if (i == 0 && j == 0) {
@@ -1855,7 +1855,7 @@
 	EXPECT_EQ(run_res.func, FFA_YIELD_32);
 
 	/* Ensure we still have access. */
-	for (int i = 0; i < PAGE_SIZE; ++i) {
+	for (size_t i = 0; i < PAGE_SIZE; ++i) {
 		ASSERT_EQ(ptr[i], 'b');
 		ptr[i]++;
 	}
@@ -1879,7 +1879,7 @@
 	EXPECT_EQ(run_res.func, FFA_YIELD_32);
 
 	/* Ensure we still have access. */
-	for (int i = 0; i < PAGE_SIZE; ++i) {
+	for (size_t i = 0; i < PAGE_SIZE; ++i) {
 		ASSERT_EQ(ptr[i], 'b');
 		ptr[i]++;
 	}
@@ -1924,7 +1924,7 @@
 	EXPECT_EQ(run_res.func, FFA_YIELD_32);
 
 	/* Ensure we still have access. */
-	for (int i = 0; i < PAGE_SIZE; ++i) {
+	for (size_t i = 0; i < PAGE_SIZE; ++i) {
 		ASSERT_EQ(ptr[i], 'b');
 	}
 
@@ -1950,7 +1950,7 @@
 	EXPECT_EQ(run_res.func, FFA_YIELD_32);
 
 	/* Ensure we still have access. */
-	for (int i = 0; i < PAGE_SIZE; ++i) {
+	for (size_t i = 0; i < PAGE_SIZE; ++i) {
 		ASSERT_EQ(ptr[i], 'b');
 		ptr[i]++;
 	}
@@ -2155,7 +2155,7 @@
 
 	/* Ensure we can't donate any sub section of memory to another VM. */
 	constituents[0].page_count = 1;
-	for (int i = 1; i < PAGE_SIZE * 2; i++) {
+	for (size_t i = 1; i < PAGE_SIZE * 2; i++) {
 		constituents[0].address = (uint64_t)pages + PAGE_SIZE;
 		EXPECT_EQ(ffa_memory_region_init_single_receiver(
 				  mb.send, HF_MAILBOX_SIZE, HF_PRIMARY_VM_ID,
@@ -2230,7 +2230,7 @@
 
 	/* Ensure we can't donate any sub section of memory to another VM. */
 	constituents[0].page_count = 1;
-	for (int i = 1; i < PAGE_SIZE * 2; i++) {
+	for (size_t i = 1; i < PAGE_SIZE * 2; i++) {
 		constituents[0].address = (uint64_t)pages + PAGE_SIZE;
 		EXPECT_EQ(ffa_memory_region_init_single_receiver(
 				  mb.send, HF_MAILBOX_SIZE, HF_PRIMARY_VM_ID,
@@ -2322,7 +2322,7 @@
 
 	/* Attempt to lend again with different permissions. */
 	constituents[0].page_count = 1;
-	for (int i = 0; i < 2; i++) {
+	for (size_t i = 0; i < 2; i++) {
 		constituents[0].address = (uint64_t)pages + i * PAGE_SIZE;
 		EXPECT_EQ(ffa_memory_region_init_single_receiver(
 				  mb.send, HF_MAILBOX_SIZE, HF_PRIMARY_VM_ID,
@@ -2391,7 +2391,7 @@
 
 	/* Attempt to share again with different permissions. */
 	constituents[0].page_count = 1;
-	for (int i = 0; i < 2; i++) {
+	for (size_t i = 0; i < 2; i++) {
 		constituents[0].address = (uint64_t)pages + i * PAGE_SIZE;
 		EXPECT_EQ(ffa_memory_region_init_single_receiver(
 				  mb.send, HF_MAILBOX_SIZE, HF_PRIMARY_VM_ID,
@@ -3360,7 +3360,7 @@
 
 	EXPECT_EQ(ffa_run(recipient, 0).func, FFA_YIELD_32);
 
-	for (int i = 0; i < PAGE_SIZE; ++i) {
+	for (size_t i = 0; i < PAGE_SIZE; ++i) {
 		/* Should have been incremented by each receiver. */
 		uint8_t value = i + 1;
 		EXPECT_EQ(ptr[i], value);
@@ -3874,7 +3874,7 @@
 	/* Run service1 for it access memory. */
 	EXPECT_EQ(ffa_run(service1_info->vm_id, 0).func, FFA_YIELD_32);
 
-	for (int i = 0; i < PAGE_SIZE; ++i) {
+	for (size_t i = 0; i < PAGE_SIZE; ++i) {
 		/* Should have been incremented by each receiver. */
 		uint8_t value = i + 1;
 		EXPECT_EQ(ptr[i], value);
@@ -4028,7 +4028,7 @@
 	/* Run service2 for it access memory. */
 	EXPECT_EQ(ffa_run(service2_info->vm_id, 0).func, FFA_YIELD_32);
 
-	for (int i = 0; i < PAGE_SIZE; ++i) {
+	for (size_t i = 0; i < PAGE_SIZE; ++i) {
 		/* Should have been incremented by each receiver. */
 		uint8_t value = i + 1;
 		EXPECT_EQ(ptr[i], value);
diff --git a/test/vmapi/primary_with_secondaries/services/arch/aarch64/el0/interruptible_echo.c b/test/vmapi/primary_with_secondaries/services/arch/aarch64/el0/interruptible_echo.c
index 218d0ea..7476280 100644
--- a/test/vmapi/primary_with_secondaries/services/arch/aarch64/el0/interruptible_echo.c
+++ b/test/vmapi/primary_with_secondaries/services/arch/aarch64/el0/interruptible_echo.c
@@ -41,7 +41,7 @@
 		irq();
 		received = ffa_msg_wait();
 	} while (received.func == FFA_ERROR_32 &&
-		 received.arg2 == FFA_INTERRUPTED);
+		 received.arg2 == (uint32_t)FFA_INTERRUPTED);
 
 	return received;
 }
diff --git a/test/vmapi/primary_with_secondaries/services/arch/aarch64/secure/secure_interrupts.c b/test/vmapi/primary_with_secondaries/services/arch/aarch64/secure/secure_interrupts.c
index 389a38b..9ee0ef6 100644
--- a/test/vmapi/primary_with_secondaries/services/arch/aarch64/secure/secure_interrupts.c
+++ b/test/vmapi/primary_with_secondaries/services/arch/aarch64/secure/secure_interrupts.c
@@ -48,7 +48,7 @@
 	 */
 	res = smc32(0x82000100, interrupt_id, 0, 0, 0, 0, 0, 0);
 
-	EXPECT_NE(res.func, SMCCC_ERROR_UNKNOWN);
+	EXPECT_NE((int64_t)res.func, SMCCC_ERROR_UNKNOWN);
 
 	/* Give back control to PVM. */
 	ffa_yield();
diff --git a/test/vmapi/primary_with_secondaries/services/memory.c b/test/vmapi/primary_with_secondaries/services/memory.c
index ce319a0..22a5983 100644
--- a/test/vmapi/primary_with_secondaries/services/memory.c
+++ b/test/vmapi/primary_with_secondaries/services/memory.c
@@ -1296,14 +1296,14 @@
 	/* Run service2 for it to fetch the memory. */
 	EXPECT_EQ(ffa_run(service2_info->vm_id, 0).func, FFA_YIELD_32);
 
-	for (int i = 0; i < PAGE_SIZE; ++i) {
+	for (size_t i = 0; i < PAGE_SIZE; ++i) {
 		ptr[i] = i;
 	}
 
 	/* Run service2 for it to increment the memory. */
 	EXPECT_EQ(ffa_run(service2_info->vm_id, 0).func, FFA_YIELD_32);
 
-	for (int i = 0; i < PAGE_SIZE; ++i) {
+	for (size_t i = 0; i < PAGE_SIZE; ++i) {
 		EXPECT_EQ(ptr[i], i + 1);
 	}