aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Dykes <mardyk01@review.trustedfirmware.org>2020-02-10 17:20:53 +0000
committerTrustedFirmware Code Review <review@review.trustedfirmware.org>2020-02-10 17:20:53 +0000
commit513b6165ee16f5106b5048b6852939dcdc6d8ae2 (patch)
treeb493bf88f0abd19fca48be121b62710b57dda747
parentc8e0f950c1fcb3e76a6d5ec80c3bb8f99fcd941f (diff)
parent466bb285c6985027c75a230e39f2ae246fd07971 (diff)
downloadtrusted-firmware-a-513b6165ee16f5106b5048b6852939dcdc6d8ae2.tar.gz
Merge "coverity: Fix MISRA null pointer violations" into integration
-rw-r--r--bl1/aarch64/bl1_context_mgmt.c4
-rw-r--r--bl1/bl1_main.c8
-rw-r--r--bl2/bl2_image_load_v2.c14
-rw-r--r--common/desc_image_load.c12
-rw-r--r--drivers/console/multi_console.c8
-rw-r--r--lib/utils/mem_region.c6
-rw-r--r--plat/arm/common/arm_bl2_setup.c4
7 files changed, 28 insertions, 28 deletions
diff --git a/bl1/aarch64/bl1_context_mgmt.c b/bl1/aarch64/bl1_context_mgmt.c
index 8be8830a3..210c35842 100644
--- a/bl1/aarch64/bl1_context_mgmt.c
+++ b/bl1/aarch64/bl1_context_mgmt.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2015-2020, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -69,7 +69,7 @@ void bl1_prepare_next_image(unsigned int image_id)
security_state = GET_SECURITY_STATE(next_bl_ep->h.attr);
/* Setup the Secure/Non-Secure context if not done already. */
- if (!cm_get_context(security_state))
+ if (cm_get_context(security_state) == NULL)
cm_set_context(&bl1_cpu_context[security_state], security_state);
/* Prepare the SPSR for the next BL image. */
diff --git a/bl1/bl1_main.c b/bl1/bl1_main.c
index cd6fe7d5e..bff8d22f5 100644
--- a/bl1/bl1_main.c
+++ b/bl1/bl1_main.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2019, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2013-2020, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -26,7 +26,7 @@
/* BL1 Service UUID */
DEFINE_SVC_UUID2(bl1_svc_uid,
- 0xd46739fd, 0xcb72, 0x9a4d, 0xb5, 0x75,
+ U(0xd46739fd), 0xcb72, 0x9a4d, 0xb5, 0x75,
0x67, 0x15, 0xd6, 0xf4, 0xbb, 0x4a);
static void bl1_load_bl2(void);
@@ -172,7 +172,7 @@ static void bl1_load_bl2(void)
/* Get the image descriptor */
image_desc = bl1_plat_get_image_desc(BL2_IMAGE_ID);
- assert(image_desc);
+ assert(image_desc != NULL);
/* Get the image info */
image_info = &image_desc->image_info;
@@ -276,7 +276,7 @@ register_t bl1_smc_wrapper(uint32_t smc_fid,
{
register_t x1, x2, x3, x4;
- assert(handle);
+ assert(handle != NULL);
get_smc_params_from_ctx(handle, x1, x2, x3, x4);
return bl1_smc_handler(smc_fid, x1, x2, x3, x4, cookie, handle, flags);
diff --git a/bl2/bl2_image_load_v2.c b/bl2/bl2_image_load_v2.c
index 1fbdbabac..81d4b2bcc 100644
--- a/bl2/bl2_image_load_v2.c
+++ b/bl2/bl2_image_load_v2.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016-2018, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2016-2020, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -35,13 +35,13 @@ struct entry_point_info *bl2_load_images(void)
* Get information about the images to load.
*/
bl2_load_info = plat_get_bl_image_load_info();
- assert(bl2_load_info);
- assert(bl2_load_info->head);
+ assert(bl2_load_info != NULL);
+ assert(bl2_load_info->head != NULL);
assert(bl2_load_info->h.type == PARAM_BL_LOAD_INFO);
assert(bl2_load_info->h.version >= VERSION_2);
bl2_node_info = bl2_load_info->head;
- while (bl2_node_info) {
+ while (bl2_node_info != NULL) {
/*
* Perform platform setup before loading the image,
* if indicated in the image attributes AND if NOT
@@ -91,11 +91,11 @@ struct entry_point_info *bl2_load_images(void)
* Get information to pass to the next image.
*/
bl2_to_next_bl_params = plat_get_next_bl_params();
- assert(bl2_to_next_bl_params);
- assert(bl2_to_next_bl_params->head);
+ assert(bl2_to_next_bl_params != NULL);
+ assert(bl2_to_next_bl_params->head != NULL);
assert(bl2_to_next_bl_params->h.type == PARAM_BL_PARAMS);
assert(bl2_to_next_bl_params->h.version >= VERSION_2);
- assert(bl2_to_next_bl_params->head->ep_info);
+ assert(bl2_to_next_bl_params->head->ep_info != NULL);
/* Populate arg0 for the next BL image if not already provided */
if (bl2_to_next_bl_params->head->ep_info->args.arg0 == (u_register_t)0)
diff --git a/common/desc_image_load.c b/common/desc_image_load.c
index f2e8f6054..b4835978b 100644
--- a/common/desc_image_load.c
+++ b/common/desc_image_load.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016-2019, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2016-2020, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -301,9 +301,9 @@ void bl31_params_parse_helper(u_register_t param,
image_info_t *bl33_image_info;
} *v1 = (void *)(uintptr_t)param;
assert(v1->h.type == PARAM_BL31);
- if (bl32_ep_info_out)
+ if (bl32_ep_info_out != NULL)
*bl32_ep_info_out = *v1->bl32_ep_info;
- if (bl33_ep_info_out)
+ if (bl33_ep_info_out != NULL)
*bl33_ep_info_out = *v1->bl33_ep_info;
return;
}
@@ -311,12 +311,12 @@ void bl31_params_parse_helper(u_register_t param,
assert(v2->h.version == PARAM_VERSION_2);
assert(v2->h.type == PARAM_BL_PARAMS);
- for (node = v2->head; node; node = node->next_params_info) {
+ for (node = v2->head; node != NULL; node = node->next_params_info) {
if (node->image_id == BL32_IMAGE_ID)
- if (bl32_ep_info_out)
+ if (bl32_ep_info_out != NULL)
*bl32_ep_info_out = *node->ep_info;
if (node->image_id == BL33_IMAGE_ID)
- if (bl33_ep_info_out)
+ if (bl33_ep_info_out != NULL)
*bl33_ep_info_out = *node->ep_info;
}
}
diff --git a/drivers/console/multi_console.c b/drivers/console/multi_console.c
index 215f49517..0665f202f 100644
--- a/drivers/console/multi_console.c
+++ b/drivers/console/multi_console.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2019, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2018-2020, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -90,7 +90,7 @@ int console_putc(int c)
console_t *console;
for (console = console_list; console != NULL; console = console->next)
- if ((console->flags & console_state) && console->putc) {
+ if ((console->flags & console_state) && (console->putc != NULL)) {
int ret = do_putc(c, console);
if ((err == ERROR_NO_VALID_CONSOLE) || (ret < err))
err = ret;
@@ -107,7 +107,7 @@ int console_getc(void)
do { /* Keep polling while at least one console works correctly. */
for (console = console_list; console != NULL;
console = console->next)
- if ((console->flags & console_state) && console->getc) {
+ if ((console->flags & console_state) && (console->getc != NULL)) {
int ret = console->getc(console);
if (ret >= 0)
return ret;
@@ -125,7 +125,7 @@ int console_flush(void)
console_t *console;
for (console = console_list; console != NULL; console = console->next)
- if ((console->flags & console_state) && console->flush) {
+ if ((console->flags & console_state) && (console->flush != NULL)) {
int ret = console->flush(console);
if ((err == ERROR_NO_VALID_CONSOLE) || (ret < err))
err = ret;
diff --git a/lib/utils/mem_region.c b/lib/utils/mem_region.c
index 08bccf64b..6bd78ba82 100644
--- a/lib/utils/mem_region.c
+++ b/lib/utils/mem_region.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2017-2020, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -32,7 +32,7 @@ void clear_mem_regions(mem_region_t *tbl, size_t nregions)
{
size_t i;
- assert(tbl);
+ assert(tbl != NULL);
assert(nregions > 0);
for (i = 0; i < nregions; i++) {
@@ -114,7 +114,7 @@ int mem_region_in_array_chk(mem_region_t *tbl, size_t nregions,
uintptr_t region_start, region_end, start, end;
size_t i;
- assert(tbl);
+ assert(tbl != NULL);
assert(nbytes > 0);
assert(!check_uptr_overflow(addr, nbytes-1));
diff --git a/plat/arm/common/arm_bl2_setup.c b/plat/arm/common/arm_bl2_setup.c
index cdf87ca55..9adb1ea5e 100644
--- a/plat/arm/common/arm_bl2_setup.c
+++ b/plat/arm/common/arm_bl2_setup.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2015-2020, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -150,7 +150,7 @@ int arm_bl2_handle_post_image_load(unsigned int image_id)
bl_mem_params_node_t *pager_mem_params = NULL;
bl_mem_params_node_t *paged_mem_params = NULL;
#endif
- assert(bl_mem_params);
+ assert(bl_mem_params != NULL);
switch (image_id) {
#ifdef __aarch64__