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 /bl1 | |
parent | 235c8174ffe55bfc1108c02e0b41ca9916428f21 (diff) | |
download | arm-trusted-firmware-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 'bl1')
-rw-r--r-- | bl1/aarch64/bl1_context_mgmt.c | 4 | ||||
-rw-r--r-- | bl1/bl1_main.c | 8 |
2 files changed, 6 insertions, 6 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); |