Received: by 2002:ab2:6486:0:b0:1ef:eae8:a797 with SMTP id de6csp420810lqb; Sat, 16 Mar 2024 09:29:43 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWd8LZXWGt97zjMAD6qGwgko7Poww41chz3+mtz/ca82xNFiJ5gZ6UyE+n/RZKtUbWV6kNHOSomBPEBGuKh/eEjrfqDpf0KIP7Q9Dyxaw== X-Google-Smtp-Source: AGHT+IEQhq6J6NDPwxON4VDLYsUJ8DKHYWqQxxpim7yC1jqPqqI7F0gigtQ77IyT39GFISeGq2H1 X-Received: by 2002:a17:907:6d1d:b0:a46:8d95:ff7e with SMTP id sa29-20020a1709076d1d00b00a468d95ff7emr4277583ejc.21.1710606583589; Sat, 16 Mar 2024 09:29:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710606583; cv=pass; d=google.com; s=arc-20160816; b=bZ+tpXim0TGCbzRxQScz5NwoxE7ZLON5JQIqoYZ759IzgcSA9+U3spCcJ2zjsUsNmX U+cRD0vuM8DMvZuEE0BVniETrq69lC2qJHIRSklnwWsCcXJfifPmFHXCTTPvgJRsFEbQ M8QPs5Q7z0Syo+h1nF8Yir9uElgqzYRn4MfXRQAwbLwiJ7lHVqEZPnougY5pjBYoPafY O3PPfTV3Mumz1qXVWvVm0Yrw874Uj/qFMNSktsGHXXqO2ZVC0i8YCAte1b6bYiNTzwyo 5CWjcG5jlesIZjgZ7FZPPpvIiMN6xe/1bPUXlx9uUBQLXY0pQBicSBBTzChQ+Ikm2CGn 42NQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=wkDXkuVlYxoyBTZlP116YXQKTa/CmWptI27u8eKhVp0=; fh=ergkN79Ov3Ycb6ynJJu5+4LQR7+QX7kcPLHt3YYoUaY=; b=hP4wJ8m+96RFuAPM18XDWpGFqHzHiQY6oC9EF69YdTPvoZHaexmR64dOmPO39DECPX BMhL6D3ITLsyMf2sHONy7pxosgCpaVFDdmL2cJbGzMkHeLhSD6k9ArrcRp/vbcWHyF0c 57R3sLr73PIzgzfP64M8gD/l88wSdYIcwrp7DwZNcW/Yrs/Ja3G3V2/8hjCUpk98Nd0L yjCJyzbDsLEriiwhVMg1ZU6vmKUh85oZ5bHh4HyFc5fniKRFMtERL967ba+arq6HOjNt lafswYRt9Spdp9PSQe+44YOBkCxAM7j83Z7FczA8OKwgxzzealHPajmDqvUBszzguST/ Vtuw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=MwrqswgV; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-105231-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-105231-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id d8-20020a170906344800b00a4659bc12f9si2711891ejb.771.2024.03.16.09.29.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Mar 2024 09:29:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-105231-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=MwrqswgV; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-105231-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-105231-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 4FBF61F21953 for ; Sat, 16 Mar 2024 16:29:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5E5181BF38; Sat, 16 Mar 2024 16:29:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="MwrqswgV" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0EC581BDD0; Sat, 16 Mar 2024 16:29:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710606570; cv=none; b=gPO1wamtqrbPgBiC9G4B2ik4QRRtnHr0LffKsxTt7qmBj06jwVn+CELqotBsHiApRKK03PK5uRqF7Aui3uiu7ARPeEa3uk6eELPqOQu63t6PYNmm4Jd2358Y+B226RQsWBJojC39r/Az7/5LTU1SCGfCt02ZRI+GNmyxlQY6FLg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710606570; c=relaxed/simple; bh=5qE8kYJREZWCNMC1klayr2kNVh5Rg7+5qdAS3gKxcg4=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=IcLCE8I9nKL4YL86Cfj+fgniCB22IgwPBk6/ca0aYm+ctVklkLvBzRzpvtC6LCjs3O/Q4vVM8fZRKbOK7KGATgPlWJT5/pD5OCrJ8gwdiUjbMVXdRINJ2aX5BUPswq26BeHL15VawEyFptW5paMQNNGEtkyajdLYrOXBQT/D6Fs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=MwrqswgV; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id DF03CC433F1; Sat, 16 Mar 2024 16:29:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1710606569; bh=5qE8kYJREZWCNMC1klayr2kNVh5Rg7+5qdAS3gKxcg4=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=MwrqswgVxGCPKB7gHtMKSFzUTipBn3n9+ODM2kZBJaCwPT9ZnEJMlSg6Z9RPPknIT jYRQBPiG+vRDIBz6MNr9CSY/4XJgP2aY4t0ZktSOaH9mAuvKeWrlAFii3zuz77nlxa FClu1D6NisoqLnoO00n1Ciz1zR10tujQO6hyNWRhVtXH7dAQ9GK6hlFBUmFwkO0SGz YIzQMoCu+1kRPpGUpfNNvUiEZKwKa724Jj8S6TUHJSA36255oTyItSawoO0UunWeQO PKUDgpLII9GMXU1RkdnP/N06Md1oOezUWhdhWTZQHgLMAosEWgvQ0iXl++LPz+/onn oqfQo09C9exeg== Message-ID: <893d73c3-e449-49ad-b297-1acef5dae38e@kernel.org> Date: Sat, 16 Mar 2024 10:29:27 -0600 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH net] nexthop: fix uninitialized variable in nla_put_nh_group_stats() Content-Language: en-US To: Dan Carpenter , Ido Schimmel Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Petr Machata , Kees Cook , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org References: From: David Ahern In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 3/16/24 3:46 AM, Dan Carpenter wrote: > The nh_grp_hw_stats_update() function doesn't always set "hw_stats_used" > so it could be used without being initialized. Set it to false. > > Fixes: 5072ae00aea4 ("net: nexthop: Expose nexthop group HW stats to user space") > Signed-off-by: Dan Carpenter > --- > net/ipv4/nexthop.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/net/ipv4/nexthop.c b/net/ipv4/nexthop.c > index 74928a9d1aa4..c25bfdf4e25f 100644 > --- a/net/ipv4/nexthop.c > +++ b/net/ipv4/nexthop.c > @@ -824,8 +824,8 @@ static int nla_put_nh_group_stats(struct sk_buff *skb, struct nexthop *nh, > u32 op_flags) > { > struct nh_group *nhg = rtnl_dereference(nh->nh_grp); > + bool hw_stats_used = false; > struct nlattr *nest; > - bool hw_stats_used; > int err; > int i; > Reviewed-by: David Ahern The flag could be moved under `if (op_flags & NHA_OP_FLAG_DUMP_HW_STATS ...` as well.