From 8b356fd9fbc5928d7cb54d788ee516ca0c1eed05 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Mon, 27 Jan 2025 16:32:27 +0200 Subject: [PATCH] Bluetooth: Host: Fix overwriting ECC error value Jump straight to the exit portion of the function in the case that psa_destroy_key() failed and we set err to a non-zero value. This also fixes Coverity CID 487701 "Code maintainability issues (UNUSED_VALUE)". Signed-off-by: Johan Hedberg --- subsys/bluetooth/host/ecc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/subsys/bluetooth/host/ecc.c b/subsys/bluetooth/host/ecc.c index 3a99fc6b3bb..380f755033f 100644 --- a/subsys/bluetooth/host/ecc.c +++ b/subsys/bluetooth/host/ecc.c @@ -213,6 +213,7 @@ static void generate_dh_key(struct k_work *work) if (psa_destroy_key(key_id) != PSA_SUCCESS) { LOG_ERR("Failed to destroy the key"); err = -EIO; + goto exit; } err = 0;