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 /lib/utils | |
parent | 235c8174ffe55bfc1108c02e0b41ca9916428f21 (diff) |
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 'lib/utils')
-rw-r--r-- | lib/utils/mem_region.c | 6 |
1 files changed, 3 insertions, 3 deletions
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)); |