Fix: Eliminate warnings
Consider warnings as errors and correct them.
Signed-off-by: Gabor Toth <gabor.toth2@arm.com>
Change-Id: I2d777ee56b21750966b75147be6c4eb73229043f
diff --git a/components/app/remote-test-runner/remote_test_runner.cpp b/components/app/remote-test-runner/remote_test_runner.cpp
index 66d81f6..04c3113 100644
--- a/components/app/remote-test-runner/remote_test_runner.cpp
+++ b/components/app/remote-test-runner/remote_test_runner.cpp
@@ -121,7 +121,7 @@
void remote_test_runner::output_list(const struct test_summary &summary,
const std::vector<struct test_result> &results)
{
- for (int i = 0; i < results.size(); ++i) {
+ for (size_t i = 0; i < results.size(); ++i) {
printf("TEST(%s, %s)\n", results[i].group, results[i].name);
}
@@ -132,7 +132,7 @@
void remote_test_runner::output_results(const struct test_summary &summary,
const std::vector<struct test_result> &results)
{
- for (int i = 0; i < results.size(); ++i) {
+ for (size_t i = 0; i < results.size(); ++i) {
printf("TEST(%s, %s) ", results[i].group, results[i].name);
diff --git a/components/common/uuid/uuid.c b/components/common/uuid/uuid.c
index 6d26cfa..16b6730 100644
--- a/components/common/uuid/uuid.c
+++ b/components/common/uuid/uuid.c
@@ -52,10 +52,7 @@
/* Note that a valid canonical uuid may be part of a longer string
* such as a urn.
*/
- size_t input_len = strnlen(canonical_form, UUID_CANONICAL_FORM_LEN);
-
- if (input_len == UUID_CANONICAL_FORM_LEN) {
-
+ if (!memchr(canonical_form, '\0', UUID_CANONICAL_FORM_LEN)) {
size_t i;
valid_chars = UUID_CANONICAL_FORM_LEN;
diff --git a/components/service/crypto/client/caller/packed-c/crypto_caller_verify_pkcs7_signature.h b/components/service/crypto/client/caller/packed-c/crypto_caller_verify_pkcs7_signature.h
index fef4d28..53335d5 100644
--- a/components/service/crypto/client/caller/packed-c/crypto_caller_verify_pkcs7_signature.h
+++ b/components/service/crypto/client/caller/packed-c/crypto_caller_verify_pkcs7_signature.h
@@ -29,19 +29,24 @@
int status = RPC_ERROR_INTERNAL;
size_t req_len = 0;
+ if (signature_cert_len > UINT16_MAX ||
+ hash_len > UINT16_MAX ||
+ public_key_cert_len > signature_cert_len)
+ return RPC_ERROR_INVALID_VALUE;
+
struct tlv_record signature_record = {
.tag = TS_CRYPTO_VERIFY_PKCS7_SIGNATURE_IN_TAG_SIGNATURE,
- .length = signature_cert_len,
+ .length = (uint16_t)signature_cert_len,
.value = signature_cert
};
struct tlv_record hash_record = { .tag = TS_CRYPTO_VERIFY_PKCS7_SIGNATURE_IN_TAG_HASH,
- .length = hash_len,
+ .length = (uint16_t)hash_len,
.value = hash };
struct tlv_record public_key_record = {
.tag = TS_CRYPTO_VERIFY_PKCS7_SIGNATURE_IN_TAG_PUBLIC_KEY_CERT,
- .length = public_key_cert_len,
+ .length = (uint16_t)public_key_cert_len,
.value = public_key_cert
};
diff --git a/components/service/spm_test/sp.c b/components/service/spm_test/sp.c
index c79051e..0b75d94 100644
--- a/components/service/spm_test/sp.c
+++ b/components/service/spm_test/sp.c
@@ -881,7 +881,7 @@
return_error(err, msg);
}
-void test_mem_get_set(struct ffa_init_info *init_info)
+void test_mem_get_set(union ffa_boot_info *boot_info)
{
void *addr = NULL;
ffa_result res = FFA_OK;
@@ -895,7 +895,7 @@
DMSG("Testing FFA_MEM_PERM_GET/SET");
config_ramstore_init();
- if (!sp_config_load(init_info)) {
+ if (!sp_config_load(boot_info)) {
EMSG("Failed to load SP config");
goto err;
}
@@ -957,8 +957,6 @@
struct ffa_direct_msg msg = {0};
uint16_t own_id = 0;
- (void)boot_info;
-
/* Boot phase */
if (sp_discovery_own_id_get(&own_id) != SP_RESULT_OK) {
EMSG("Couldn't get own_id!!");
diff --git a/components/service/uefi/smm_variable/backend/uefi_variable_store.c b/components/service/uefi/smm_variable/backend/uefi_variable_store.c
index 14fb996..c93efbc 100644
--- a/components/service/uefi/smm_variable/backend/uefi_variable_store.c
+++ b/components/service/uefi/smm_variable/backend/uefi_variable_store.c
@@ -42,9 +42,9 @@
const struct variable_info *info,
const SMM_VARIABLE_COMMUNICATE_ACCESS_VARIABLE *var);
+#if defined(UEFI_AUTH_VAR)
static bool compare_guid(const EFI_GUID *guid1, const EFI_GUID *guid2);
-#if defined(UEFI_AUTH_VAR)
/* Creating a map of the EFI SMM variable for easier access */
typedef struct {
const SMM_VARIABLE_COMMUNICATE_ACCESS_VARIABLE *smm_variable;
@@ -70,7 +70,7 @@
static efi_status_t select_verification_keys(
const efi_data_map new_var, EFI_GUID global_variable_guid, EFI_GUID security_database_guid,
uint64_t maximum_variable_size,
- const SMM_VARIABLE_COMMUNICATE_ACCESS_VARIABLE **allowed_key_store_variables);
+ SMM_VARIABLE_COMMUNICATE_ACCESS_VARIABLE **allowed_key_store_variables);
static efi_status_t verify_var_by_key_var(const efi_data_map *new_var,
const efi_data_map *key_store_var,
@@ -113,7 +113,7 @@
static efi_status_t check_name_terminator(const int16_t *name, size_t name_size);
#if defined(UEFI_AUTH_VAR)
-static bool compare_name_to_key_store_name(const uint16_t *name1, size_t size1,
+static bool compare_name_to_key_store_name(const int16_t *name1, size_t size1,
const uint16_t *name2, size_t size2);
#endif
@@ -655,6 +655,7 @@
return status;
}
+#if defined(UEFI_AUTH_VAR)
/*
* Returns whether the two guid-s equal. To avoid structure padding related error
* the fields are checked separately instead of memcmp.
@@ -666,7 +667,6 @@
!memcmp(&guid1->Data4, &guid2->Data4, sizeof(guid1->Data4));
}
-#if defined(UEFI_AUTH_VAR)
/*
* Creates a "map" that contains pointers to some of the fields of the SMM variable and the
* UEFI variable stored in the SMM data field. This way a variable is parsed only once.
@@ -873,7 +873,7 @@
static efi_status_t select_verification_keys(
const efi_data_map new_var, EFI_GUID global_variable_guid, EFI_GUID security_database_guid,
uint64_t maximum_variable_size,
- const SMM_VARIABLE_COMMUNICATE_ACCESS_VARIABLE **allowed_key_store_variables)
+ SMM_VARIABLE_COMMUNICATE_ACCESS_VARIABLE **allowed_key_store_variables)
{
/**
* UEFI: Page 254
@@ -1152,7 +1152,7 @@
status = select_verification_keys(var_map, global_variable_guid, security_database_guid,
variable_info.MaximumVariableSize,
- &allowed_key_store_variables);
+ &allowed_key_store_variables[0]);
if (status != EFI_SUCCESS)
goto end;
@@ -1512,7 +1512,7 @@
#if defined(UEFI_AUTH_VAR)
/* Compares SMM variable name to key variable name. */
-static bool compare_name_to_key_store_name(const uint16_t *name1, size_t size1,
+static bool compare_name_to_key_store_name(const int16_t *name1, size_t size1,
const uint16_t *name2, size_t size2)
{
if (!name1 || !name2)