From 466bb285c6985027c75a230e39f2ae246fd07971 Mon Sep 17 00:00:00 2001 From: Zelalem Date: Wed, 5 Feb 2020 14:12:39 -0600 Subject: 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 --- lib/utils/mem_region.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib') 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)); -- cgit v1.2.3