From 075c826566acfa8d207118791c046e06268e9c1e Mon Sep 17 00:00:00 2001 From: James Chesterman Date: Thu, 3 Apr 2025 09:52:22 +0100 Subject: [PATCH] mod/power_domain: Add check for cluster count being zero This ensures that a division by zero does not occur. Signed-off-by: James Chesterman --- module/power_domain/src/power_domain_utils.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/module/power_domain/src/power_domain_utils.c b/module/power_domain/src/power_domain_utils.c index 0cd6739bf..541c9a914 100644 --- a/module/power_domain/src/power_domain_utils.c +++ b/module/power_domain/src/power_domain_utils.c @@ -1,6 +1,6 @@ /* * Arm SCP/MCP Software - * Copyright (c) 2020-2024, Arm Limited and Contributors. All rights reserved. + * Copyright (c) 2020-2025, Arm Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause * @@ -42,6 +42,10 @@ static int create_core_cluster_pd_element_table( unsigned int core_element_counter = 0; unsigned int core_idx; unsigned int cluster_idx; + + if (cluster_count == 0) { + return FWK_E_PARAM; + } unsigned int cores_per_clusters = core_count / cluster_count; int status; -- GitLab