From patchwork Wed Apr 10 22:12:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 1922248 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=lStMdiZM; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VFHBF71xcz1yY8 for ; Thu, 11 Apr 2024 08:12:21 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id F41AA87B71; Thu, 11 Apr 2024 00:12:17 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=canonical.com 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=canonical.com header.i=@canonical.com header.b="lStMdiZM"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id EC57A88120; Thu, 11 Apr 2024 00:12:15 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-3.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, 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 smtp-relay-canonical-0.canonical.com (smtp-relay-canonical-0.canonical.com [185.125.188.120]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id E4F118657F for ; Thu, 11 Apr 2024 00:12:13 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=canonical.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=heinrich.schuchardt@canonical.com Received: from LT2ubnt.fritz.box (ip-062-143-245-032.um16.pools.vodafone-ip.de [62.143.245.32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-0.canonical.com (Postfix) with ESMTPSA id ECD763FE50; Wed, 10 Apr 2024 22:12:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1712787133; bh=Z2doeSa4W6SzzfylA4dUKohuyRStQcje0TpTZIkQFrI=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=lStMdiZMUm8/sxkmoEIVTOTGkmHSbfkOtsQrH3+rIPmE8w2qcjRpF6vFwI1h7rUz3 +5Mf5gzCuD7F9eWhSFZes6ZBcMvhu7StatJsohWzXqzjdomn5Uoah7u0Q5KcI5ipAl r+6KwuPgxik10oH3u0aGoMdvKLhPNBDZmSixpi8nsIF69EvIxP6lSL7j3afNc5OQ4E ndS/KWlxtGK+kF7lOsihGPA2QFMcrs4zTtcuZoAhAI3h+PObtpNwq4NX91pziNPYWW /QvABmRDK1SXAJ6H7ogUti8aCyx1Y85qevcJ9gC7BWyJ0LFFsacAekkqi9Z86Hlatc EDPORAOSHqfXw== From: Heinrich Schuchardt To: Simon Glass Cc: Tom Rini , Bin Meng , Nam Cao , u-boot@lists.denx.de, Heinrich Schuchardt Subject: [PATCH 1/1] bootflow: always initialize bootflow_iter_set_dev parameters Date: Thu, 11 Apr 2024 00:12:06 +0200 Message-ID: <20240410221206.22782-1-heinrich.schuchardt@canonical.com> X-Mailer: git-send-email 2.43.0 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.8 at phobos.denx.de X-Virus-Status: Clean method_flags may be passed uninitialized to bootflow_iter_set_dev() if dev is not NULL. Always initialize method_flags. Addresses-Coverity-ID: 467057 Uninitialized scalar variable Signed-off-by: Heinrich Schuchardt Reviewed-by: Nam Cao --- boot/bootflow.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/boot/bootflow.c b/boot/bootflow.c index 68bf99329ab..f659a414c79 100644 --- a/boot/bootflow.c +++ b/boot/bootflow.c @@ -244,7 +244,7 @@ static int iter_incr(struct bootflow_iter *iter) if (iter->flags & BOOTFLOWIF_SINGLE_DEV) { ret = -ENOENT; } else { - int method_flags; + int method_flags = 0; ret = 0; dev = iter->dev; @@ -263,7 +263,6 @@ static int iter_incr(struct bootflow_iter *iter) } else if (IS_ENABLED(CONFIG_BOOTSTD_FULL) && iter->flags & BOOTFLOWIF_SINGLE_MEDIA) { log_debug("next in single\n"); - method_flags = 0; do { /* * Move to the next bootdev child of this media @@ -305,7 +304,6 @@ static int iter_incr(struct bootflow_iter *iter) } } else { ret = bootdev_next_prio(iter, &dev); - method_flags = 0; } } log_debug("ret=%d, dev=%p %s\n", ret, dev,