From patchwork Thu Nov 10 08:21:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilias Apalodimas X-Patchwork-Id: 623320 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp758478pvb; Thu, 10 Nov 2022 00:21:40 -0800 (PST) X-Google-Smtp-Source: AMsMyM5zy7KNEyMXNnxB8nYVQL9uOXQGgoQFe2ApWp9r2YgcgNRee7qAVDIMyld1qgvxY5KxrpQO X-Received: by 2002:a17:906:26d5:b0:7ad:c0e7:1242 with SMTP id u21-20020a17090626d500b007adc0e71242mr2327805ejc.334.1668068499883; Thu, 10 Nov 2022 00:21:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668068499; cv=none; d=google.com; s=arc-20160816; b=mRKYEMOCYJOzaP9lRTfnXjlQRKsRkqe17SclY+UDi9brWdUg2092y/bm0cBYj85Zae fmtnLprxWja1dLbR1fhUGfdKDX03lKw0Wj721fCyB+Ff2CdQ+M/EzLiwL6Kj6Nm7Gi/1 5xLlxa1Wfct/+cvy9wBqhB5aMgrhTpgIu4X30M7MOLeBEeripJVX3TyOVxlSN66UQ2rP 1nRtIL69Y624iBMEakZdzMnhhfV44K2YIEOqG+TpIW3KJJ4tHTmaBAC/2alHpQw8MG+7 vNBUwB9DUs0Seph0Tu9cr0opraxZMDTW9WfnSxwJEHTMeKYjwErK3+3XXQuc2iRmGc4y 2Ivg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=uukZ/0tFtoCc0dXLz1q+tG9uz/4WHsyIOQnVR700mrI=; b=KzzhgjVDUXCq16kgJavfbRTQctRJk/wx1gm/wDH9RGKIMy6LG1Fp9IDw/qMqkvFENw uYDpfhIzvytTFYx/cruWcuZ53uw2e3Fj8MqsmTR31RKpb6RHLehXYrAEnHnNLerI1K0L Pq56t8nctnoQaZ7fCIBB51p/2OfldaryreLMNmFK9Q17rXUgSZCvVAALWSGBSLPkK+Ys JZCE8zzovnzHrAxjTcQVvIi0JbyE97+QhKcyb4nUWXWaL3pCjck+99Eg28P0Bm52L59P V6CaCS+HxG/mlgGhG8DRW/ntClJ8YFRWj1l8R0f4pslmvt4EuIET5PJUMsi7Lh3HfEjw V/hQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=inxGCVHh; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id l9-20020a056402254900b00461ace746adsi20880642edb.453.2022.11.10.00.21.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Nov 2022 00:21:39 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=inxGCVHh; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id AA50F850FB; Thu, 10 Nov 2022 09:21:37 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="inxGCVHh"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id EED5785106; Thu, 10 Nov 2022 09:21:35 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 7852B850DA for ; Thu, 10 Nov 2022 09:21:33 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ilias.apalodimas@linaro.org Received: by mail-wr1-x434.google.com with SMTP id y16so1100279wrt.12 for ; Thu, 10 Nov 2022 00:21:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=uukZ/0tFtoCc0dXLz1q+tG9uz/4WHsyIOQnVR700mrI=; b=inxGCVHhGKH8FRf8cafsaYoOgMD7CGB2pApyQSqJ1B2HI//35e6nV+NDmyu8iVZpJH xuAayfraRkPVBlmaycnNiUPv3jnLYmITO5RM3CatlVhyQMXakHJoWlCx/6Ks0jxyIBS/ vjEe9lYs3UYrhTEHU37lN79VHtST7fX96DYRSeRDDwFkMT1jOpjuP7Kuic3/3EqrHm/G RBL2Q7OpoVv2oKHzvT+9V97UpgZ4q62ea8TQ4aZb2BeQnDeq2uNRF1wLZyadzE3hGFlV 1nrp9P8g/22l9RcY5+vdVsTDBg9LZ73AhZtRSIP38LgO+IXGhtdW42/EcV6iN2XmlYAi agtw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=uukZ/0tFtoCc0dXLz1q+tG9uz/4WHsyIOQnVR700mrI=; b=CDbIJP86rALKSQl3oT/13FdN39NVWwaf5YNKC+EGUBuwJDPUcDq0IxZG4KUHyky810 vrNMSTJs4skr6sHhOZEQCI/PaMKfGD3g+n+UiNKyNOzs+eh5NhJD9xLlsy+/pYshnmvt P69Ft+u30x6uEpCjg0qnnUnmmi1wZ1y+gIVhbzEmISNYj9TJqJ6MnEwAs9DnGdM1sKjG rIRStUevQzAA8JWw3iiNYkIlQUpdPUmGa8kzIdyVGYJ9amSCKTGkEdiVtaJva+2F59in Oub3KI1IMX3Nc/o2I4HLfiXSceciLs5q4ED03ETALDIJ9mvsALIDNdB+b3tzRdv+3sJq peKw== X-Gm-Message-State: ACrzQf3xJI5aB/vpqm1z0uZdmIkL2nbFX0UBN+sbPkVQDNIKoP5OqEwG M1Lb2FxbfrosZMsdHjs9mvgvPwItYwAYOU2R X-Received: by 2002:adf:d213:0:b0:236:9cb4:20a9 with SMTP id j19-20020adfd213000000b002369cb420a9mr40946618wrh.581.1668068493081; Thu, 10 Nov 2022 00:21:33 -0800 (PST) Received: from localhost.localdomain ([2a02:85f:fc35:4b7e:b46:e9a0:216f:aab5]) by smtp.gmail.com with ESMTPSA id k25-20020a5d5259000000b0022cc3e67fc5sm15518163wrc.65.2022.11.10.00.21.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Nov 2022 00:21:32 -0800 (PST) From: Ilias Apalodimas To: u-boot@lists.denx.de Cc: heinrich.schuchardt@canonical.com, Ilias Apalodimas , Heinrich Schuchardt Subject: [PATCH v3] efi_loader: initialize return values in efi_uninstall_multiple_protocol_interfaces_int() Date: Thu, 10 Nov 2022 10:21:24 +0200 Message-Id: <20221110082124.210306-1-ilias.apalodimas@linaro.org> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean If the va_list we got handed over contains no protocols we must return EFI_SUCCESS. However in that case the current code just returns an unintialized value. Fix that by setting the return value in the variable definition Addresses-Coverity: CID 376195: ("Uninitialized variables (UNINIT)") Signed-off-by: Ilias Apalodimas --- changes since v2: - Don't return immediately on NULL protocols. Instead go through the list of already uninstalled protocols and reinstall them changes since v1: - return EFI_SUCCESS instead of EFI_INVALID_PARAMETER lib/efi_loader/efi_boottime.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c index a56021559bbf..253f9f75ef63 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -2754,7 +2754,7 @@ efi_uninstall_multiple_protocol_interfaces_int(efi_handle_t handle, { const efi_guid_t *protocol; void *protocol_interface; - efi_status_t ret; + efi_status_t ret = EFI_SUCCESS; size_t i = 0; efi_va_list argptr_copy;