SPM: Invert tfm_spm_check_buffer_access() logic
Invert the logic for the tfm_spm_check_buffer_access() function
to conform to "0 means success" and align to other APIs. Refactor
the function itself to provide different return codes on error and
a default failure return instead of default success.
Signed-off-by: Antonio de Angelis <antonio.deangelis@arm.com>
Change-Id: I40ef814a472375cdb2c40ac75dd5f605a9eccbfe
diff --git a/secure_fw/spm/ffm/tfm_boot_data.c b/secure_fw/spm/ffm/tfm_boot_data.c
index 1b9ed64..d7db303 100644
--- a/secure_fw/spm/ffm/tfm_boot_data.c
+++ b/secure_fw/spm/ffm/tfm_boot_data.c
@@ -163,9 +163,9 @@
(void *)buf_start,
buf_size,
2);
- if (!res) {
+ if (res != TFM_SUCCESS) {
/* Not in accessible range, return error */
- args[0] = (uint32_t)TFM_ERROR_INVALID_PARAMETER;
+ args[0] = (uint32_t)res;
return;
}
#else