From b96537fe38862a6fb86c093bd0f8e583bc92bf0c Mon Sep 17 00:00:00 2001 From: Mikael Olsson Date: Tue, 21 May 2024 09:39:47 +0200 Subject: Fix uninitialized variable in trustzone secure The block_idx_end variable is left uninitialized and contains an undeterminate value. This can cause issues later when it is compared to block_idx because the comparison may not have the desired outcome. To resolve this, the block_idx_end variable is now zero initialized. Change-Id: I0767eeb4dc18ea668e6f14a386b67e4ddb9c654a Signed-off-by: Mikael Olsson --- applications/trustzone_inference/secure/main_secure.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'applications') diff --git a/applications/trustzone_inference/secure/main_secure.cpp b/applications/trustzone_inference/secure/main_secure.cpp index 1e0ea58..c070020 100644 --- a/applications/trustzone_inference/secure/main_secure.cpp +++ b/applications/trustzone_inference/secure/main_secure.cpp @@ -1,6 +1,5 @@ /* - * Copyright (c) 2021-2022 Arm Limited. All rights reserved. - * + * SPDX-FileCopyrightText: Copyright 2021-2022, 2024 Arm Limited and/or its affiliates * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the License); you may @@ -224,7 +223,7 @@ void setup_xtgu_ns(uint32_t xtgu_base, uint32_t xtcm_start, uint32_t xtcm_size) uint32_t xtcm_end = xtcm_start + xtcm_size - 1; uint32_t xtcm_address = xtcm_start; uint32_t block_idx_start = (xtcm_address / BLKSZ) / 32; - uint32_t block_idx_end; + uint32_t block_idx_end = 0; while (xtcm_address < xtcm_end) { uint32_t block_nbr = xtcm_address / BLKSZ; -- cgit v1.2.1