From patchwork Thu Nov 10 08:11:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilias Apalodimas X-Patchwork-Id: 623319 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp754983pvb; Thu, 10 Nov 2022 00:12:11 -0800 (PST) X-Google-Smtp-Source: AMsMyM5fFE1MO0vHI6EczUXH8TyAllRoIpRZgOoiStbBlmfjzg8oKWeYPGfBtOo/TjhkojVwd6xj X-Received: by 2002:a17:907:75f2:b0:7ad:e51e:837f with SMTP id jz18-20020a17090775f200b007ade51e837fmr47559011ejc.0.1668067931739; Thu, 10 Nov 2022 00:12:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668067931; cv=none; d=google.com; s=arc-20160816; b=vYUcH69tq+dzI+UxOINpGQ8sJeftmyc5poSft0UQNyC+qE5ORqW+Zr7FCwVMEDDPQG v2LKxFQ9+nyvZzUvMFfoGu1bGAuIVhEXipFU1pNgQKlIz9BZco7mjVqnQibBXuG7GWzZ N1yq8ZCsllMsj2MpAg+Rs1a+pDW0Sc79EbYbVNJhy1KHtvfSqTKigE4rwKKAHZ5oZdC/ +V585LVp9y6xVN9obs6jpBp0weXOgg1VdNf4pMsr2EqLWqL1V2LWTcqDO34Nj73IA0AG cozvCNlon6U9MZGB0fqd+9GvWQfssR5KI6e+GgwXa1fLJ6+hthKu3ZOgj4eK9QJJt8/m mA2Q== 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=fQyYeAP700bE7uD0cjSv0RHvNQNXC/D8QDNX2jE2LYc=; b=D/X701bkVszj8Hm9KdeDBHbfb9KXsYc2yMz00cQtEJk7CCzYL8mbn6Q5GFo9bu/081 8iCV0y4k3MdRmbL0PkcZ6m68I04psBdLntIpGvCBHANxpdtRkRbNIzWUQmAhRB59mOgt LIgLs5epXRyCNB26uKks8SVMR32tButPcEleGacEMvmJ8X7uskqQOPn45k3V7r3KdmNi GGp5ZTSXYw6qJtnGxer0msUqS6s1WZ4MsMRwOMZGGNit6+2UIawf0PjcQ2FSgfuIOGnW R7Hbi1necbZwNt3RsODhA2wqkcWdbfHTQI83NXORxOTd2YTptm0Ziw3LwoFZNVvQ17Tl /cUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=t2vvayXt; 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 y91-20020a50bb64000000b004574154f09asi17307621ede.529.2022.11.10.00.12.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Nov 2022 00:12:11 -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=t2vvayXt; 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 136E6850C5; Thu, 10 Nov 2022 09:12:08 +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="t2vvayXt"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 93F5D85107; Thu, 10 Nov 2022 09:12:06 +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-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) (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 3473C850C1 for ; Thu, 10 Nov 2022 09:12:04 +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-x430.google.com with SMTP id z14so1089215wrn.7 for ; Thu, 10 Nov 2022 00:12:04 -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=fQyYeAP700bE7uD0cjSv0RHvNQNXC/D8QDNX2jE2LYc=; b=t2vvayXtRjr8XOeg/iy7ZLdhp2kPKf1GXHtAlVcAYz0JYx33ApeHbNPkf8tMvd7SCY /Moygmvqa0ZZEXWEpK5vGi3/GXkXBWBxTgNSSwLU+XKb0Wz22+ecZ2Q4NqNMbhH6AT4g ZRUgFya5B7EjjL7/uYt2aKn5TZrf08OqSSziUn3KCkfv2WI6yloDNE8CSpqGSGachqxB PfkWV1DRzzzqn/Zv4kz26IsWR6mnPWQt+Gl9REVz/bSNhT2AkZEYHsYiwGZktUfhHq+N fQuXqA/kq9Vx2qGeFRPtsm66nJkpO1bCLuvhjvvBkbzCW+vk33AifXrD9dAA6E0VAgHA 5OCw== 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=fQyYeAP700bE7uD0cjSv0RHvNQNXC/D8QDNX2jE2LYc=; b=KF7GXuzMIP/z8ddlD6sOgBmxE7ibMA7bUaJo6F7ShetsXCJb/nqsOA0C7rKzhceefc 4lLBdzMMNhU8Ygw2feDK1oUJnxG0UEgm9iheDcPsjjFeZfu0W/5OMeQK8UxWpmHCcmRl xYhEjfTjDRlaB/wyL/LS/idhAeF0E5z0ZRw8pKwpuK2VNhkWXQBqYIF8bwPWuquVqyvH 15e6PcXYsTjRLu6C9BcaKphFzMBNAFpFKrosIvfKjm4p1H2YyO5btVGdBJIGpFSRfcNE AqUgt9IeNh9sLfuP1e3ohTpLPYNrgp31/cloEvE478xGWUDCkcRhxD0pQ9dO79WbC254 CZQw== X-Gm-Message-State: ACrzQf3zL7nhzuo9SaIwKIoUa7BXzltFNnP22kN4HH9ZQ8zkrKm1uqup UZq+LRo0+xCJJsE/T6V4xgEiqOCDUduln2Cj X-Received: by 2002:a05:6000:154e:b0:236:8ead:3eb4 with SMTP id 14-20020a056000154e00b002368ead3eb4mr41832306wry.71.1668067923728; Thu, 10 Nov 2022 00:12:03 -0800 (PST) Received: from localhost.localdomain ([2a02:85f:fc35:4b7e:b46:e9a0:216f:aab5]) by smtp.gmail.com with ESMTPSA id r7-20020a05600c458700b003c7087f6c9asm4417049wmo.32.2022.11.10.00.12.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Nov 2022 00:12:03 -0800 (PST) From: Ilias Apalodimas To: u-boot@lists.denx.de Cc: heinrich.schuchardt@canonical.com, Ilias Apalodimas , Heinrich Schuchardt Subject: [PATCH v2] efi_loader: initialize return values in efi_uninstall_multiple_protocol_interfaces_int() Date: Thu, 10 Nov 2022 10:11:55 +0200 Message-Id: <20221110081155.209647-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 uninitialized 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 v1: - return EFI_SUCCESS instead of EFI_INVALID_PARAMETER 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..f52d086d17bf 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; @@ -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);