diff options
author | Zelalem <zelalem.aweke@arm.com> | 2020-02-05 14:12:39 -0600 |
---|---|---|
committer | Zelalem <zelalem.aweke@arm.com> | 2020-02-05 14:53:02 -0600 |
commit | 466bb285c6985027c75a230e39f2ae246fd07971 (patch) | |
tree | 593c3f6465c7fdd981c452b5034ab8edf75b7205 /common/desc_image_load.c | |
parent | 235c8174ffe55bfc1108c02e0b41ca9916428f21 (diff) | |
download | trusted-firmware-a-466bb285c6985027c75a230e39f2ae246fd07971.tar.gz |
coverity: Fix MISRA null pointer violations
Fix code that violates the MISRA rule:
MISRA C-2012 Rule 11.9: Literal "0" shall not be used as
null pointer constant.
The fix explicitly checks whether a pointer is NULL.
Change-Id: Ibc318dc0f464982be9a34783f24ccd1d44800551
Signed-off-by: Zelalem <zelalem.aweke@arm.com>
Diffstat (limited to 'common/desc_image_load.c')
-rw-r--r-- | common/desc_image_load.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/common/desc_image_load.c b/common/desc_image_load.c index f2e8f60546..b4835978b3 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; } } |