From patchwork Thu Nov 10 07:35:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilias Apalodimas X-Patchwork-Id: 623318 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp740875pvb; Wed, 9 Nov 2022 23:35:58 -0800 (PST) X-Google-Smtp-Source: AMsMyM75SIBrQ9DMMaAbRHwrxEXC7xN3EDyB1xhsYXmmavBCv+/kkHL0AHPtaOj7za1jIvIwSy1o X-Received: by 2002:a17:906:839a:b0:78d:f308:1cd with SMTP id p26-20020a170906839a00b0078df30801cdmr2333551ejx.754.1668065757769; Wed, 09 Nov 2022 23:35:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668065757; cv=none; d=google.com; s=arc-20160816; b=PALSaHWVdhOZOmPcfgjlimb1/ma90EJ8qTt+1uzVtkR7a7ID0UmyPfMPIvPLNRbtr5 UAYUGb/apjlc2uVy0GHHwKP4PZ9w6X2GJVrx1PGGzqvYPuiJRqc1Y9ZfXlS15XcyobT8 9FiJVOaDFbRioEBdUOwJ6Ab/67g5LtTWPFYYrj0ROE6Voi5blibHBRAav0CQ1DlXRLCN MMiLHTEfgOcTpbYlz+kCuFigPZmWBAeS34H4cWb1XOVKQG33LUMyH//35w+dLMVxiOPQ uvlemORtvSZ0zkNGcwPYqf3TAihRNdUHE3Vz43QflZ5eZ7ru47s+QCBItkL5UEW5O445 lukQ== 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=+oWoIXcwnME3hyYsC55IjukXm9RNPVXHraU76cahE9Y=; b=jpzVqW+x3RngYDrUAT7yUoV46GVleV8pLbGiefEko8EgFsenBR9of6NHckIZfW/a3/ swNZyY4o0j+EmZ5NqoKH/goyosUkuZUn/FB3uNTIxyJHA+n21+AiyrTZOtk0OegKADdr yfTgcWqknTljrXITsjnnpdCfDRw7wleaBSM41mUCr6p854fNuXRUUqu2hPYPOwa4DTLI a4BGDAxX/cS/aPJnY3dtqksYMbK871A3BZiCVHpDz7lgKLzngFG88iqKeNBUonj5vKeu 9UdevG36fwm/wRtNzXBw/R9eGu9Ne9R1I1/lISua5mkVD3VSN3/f/YIyENhZJVImO6ct uEZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EPWm7DEe; 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 t5-20020a056402240500b00458b71488bdsi17596309eda.388.2022.11.09.23.35.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Nov 2022 23:35:57 -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=EPWm7DEe; 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 5BE3B850FE; Thu, 10 Nov 2022 08:35:55 +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="EPWm7DEe"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id F1DAA850FE; Thu, 10 Nov 2022 08:35:52 +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-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) (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 F16B283F5B for ; Thu, 10 Nov 2022 08:35:43 +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-wm1-x332.google.com with SMTP id v124-20020a1cac82000000b003cf7a4ea2caso2769463wme.5 for ; Wed, 09 Nov 2022 23:35:43 -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=+oWoIXcwnME3hyYsC55IjukXm9RNPVXHraU76cahE9Y=; b=EPWm7DEeJJd+A9JxzBvgDh8hQPLyoW7FEuFu/xJXXtvsd/aihofCDol8czoXmbC4/r t/4yzu1Uu6faPG5Z3pM2vdpHGTpLYLFVeKBXLY2ra2kFlPzGWo6OaDQ8Wnk9URx/8asm 4v0uYF6iUcGRV6kvzYbHDNk6aCBt9OrS70qwrOE8XtTiIyyfEblZDz1dVariWDTmbTiR 5CBajfJM3ZP4YKKEt8PoIxwTXSXhZuG18x5scFKpgVigus/DxCUKgdQEGAy6B2Gnerbw m6JjCur1bhcBU1DqqDYUBSjx/n0TBuDQuK3EK+lyEDxmChduvfO2VVUamoA+IDmv9/yN edhQ== 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=+oWoIXcwnME3hyYsC55IjukXm9RNPVXHraU76cahE9Y=; b=kLkTzkHHT9WJZ7zgh4VbKWH50QK1wVw28/prh7Wbd9jn8bPxeFLDOjs1LjexhtPME0 Kk2x2i4xxg4l5kjfLi5O1tuJ9CCsl6SRzo+LXGqOhdNaf18LlOjscVApNXgXmNfxHbgn 0EFBj2450ebxiO6bheUJBMVPtYO9oCF9U68HzWtAmwtbxRq6HZT4mKBBMpPtqKd/rBms uU4Ay+1Trl+sxHBAD6D3UJ47jTkPw1T5zFLAH+ztQHEzNLxMio0bRGIzA3wuY3d9YWeN 7ugpgKeXudWmhs3Aac5krii2pY/l9mzGsgMt5yylD/3cTji9ekfYLTor3DMpg0FO08lK Bd3g== X-Gm-Message-State: ACrzQf2JVeOk8VQ5mvj/rH2seWKloYPEg+8AJi+cEwYcy3NRnv554IHd kMizMl3K0AZ/r9Wr491iVYM/oiwTBaCpTi1R X-Received: by 2002:a05:600c:907:b0:3cf:9504:239b with SMTP id m7-20020a05600c090700b003cf9504239bmr22047934wmp.77.1668065743121; Wed, 09 Nov 2022 23:35:43 -0800 (PST) Received: from localhost.localdomain ([2a02:85f:fc35:4b7e:b46:e9a0:216f:aab5]) by smtp.gmail.com with ESMTPSA id e10-20020a05600c4e4a00b003a3170a7af9sm4121569wmq.4.2022.11.09.23.35.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Nov 2022 23:35:42 -0800 (PST) From: Ilias Apalodimas To: u-boot@lists.denx.de Cc: heinrich.schuchardt@canonical.com, Ilias Apalodimas , Heinrich Schuchardt Subject: [PATCH] efi_loader: initialize return values in efi_uninstall_multiple_protocol_interfaces_int() Date: Thu, 10 Nov 2022 09:35:31 +0200 Message-Id: <20221110073532.206657-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_INVALID_PARAMETER. However in that case the current code just returns an unintialized value. Addresses-Coverity: CID 376195: ("Uninitialized variables (UNINIT)") --- lib/efi_loader/efi_boottime.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c index a56021559bbf..96aa36ef85de 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_INVALID_PARAMETER; size_t i = 0; efi_va_list argptr_copy; @@ -2765,7 +2765,7 @@ efi_uninstall_multiple_protocol_interfaces_int(efi_handle_t handle, for (;;) { protocol = efi_va_arg(argptr, efi_guid_t*); if (!protocol) - break; + goto out; protocol_interface = efi_va_arg(argptr, void*); ret = efi_uninstall_protocol(handle, protocol, protocol_interface);