From patchwork Thu Jan 18 15:14:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Pirko X-Patchwork-Id: 862978 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=resnulli-us.20150623.gappssmtp.com header.i=@resnulli-us.20150623.gappssmtp.com header.b="iQxLbLxv"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3zMnZ80n4Rz9s81 for ; Fri, 19 Jan 2018 02:14:56 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754842AbeARPOw (ORCPT ); Thu, 18 Jan 2018 10:14:52 -0500 Received: from mail-wm0-f65.google.com ([74.125.82.65]:38660 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754513AbeARPOv (ORCPT ); Thu, 18 Jan 2018 10:14:51 -0500 Received: by mail-wm0-f65.google.com with SMTP id 141so23460214wme.3 for ; Thu, 18 Jan 2018 07:14:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=resnulli-us.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=8SCJypMOTYu6d7k/w2A1TSSjTuPHRCYTF2ttwHAY57o=; b=iQxLbLxvW3OaeVkUPG2E0quNXAfM7SXIYpXYjpm+BiI5cQFXqbrjzGFfsW6aOQCFvE 4G6UI0j85z03x+ZwVHUxTYYCuPkqrITHZuAUFBB1+iKb1rIHEmCj/uEkfjdTr4twAHdu sAU4Mj9Ym3t/p6OFwLMH13Y9EHMkoTJDVcwiqGnofppZoOpUqzqfQXOjBXCuBjR9Xf16 YMJAwC+s/yqaF7rHNghVlQD8D7yr81cFzQMZLyahKxCc5UGOwS3YxndrkUyqZBuqzfLd DfOQNcN6JsyYrQuLTXRQx1cYwfZaH4sDv+0mVj6OKe8xT96Vbq7gkfDOM7gaOKvRsge/ RfGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=8SCJypMOTYu6d7k/w2A1TSSjTuPHRCYTF2ttwHAY57o=; b=ZYG/Er7j3wNFXqeYnBvtnS/KaW9iMwm9SU5ci4iMz/eCOIsLaen61tYTqOYL2al4RD +AzRn/JxlQOTeBgJG/UxrW4fkjMsJxyyw9lAtWOSmm2L1urXS/6Zk1vppe1INyxirjRJ qSnEALYTW53SIQXe5eBxl9KF61PjTPGy3xumf//m7R6BgQzOuwPzvqoMkT8ibAODlmUH ZcjQqPx8WjxLqHV4HzirjJrCl70It0faicdEkQ5iItYpo/GuzHaD9VKhRFfFiY5BR0tC NYldHc4ogXOTG7Ob9vWmTCP/R8V5ehcKF48tVoxbwzFJL5EQsjv5W++YnJg10XnnSpdB PfzQ== X-Gm-Message-State: AKwxytcTXctFkj1dnHA+lMdB/8AzS/LEBuGcOVPbSpxy4p9TESXqoJ1Y 5g22vs2dmYe3DglJH1hq/6kLPtM1 X-Google-Smtp-Source: ACJfBou87KjHo/EPhxW85O334d+ODg0EzDhsQbwE8kqD52nMqRy2n2PDQ8mFAzxS9rs6jwif3VRLvQ== X-Received: by 10.28.156.206 with SMTP id f197mr5738136wme.112.1516288490177; Thu, 18 Jan 2018 07:14:50 -0800 (PST) Received: from localhost (jirka.pirko.cz. [84.16.102.26]) by smtp.gmail.com with ESMTPSA id r64sm5635510wma.15.2018.01.18.07.14.49 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 18 Jan 2018 07:14:49 -0800 (PST) From: Jiri Pirko To: netdev@vger.kernel.org Cc: davem@davemloft.net, jhs@mojatatu.com, xiyou.wangcong@gmail.com, mlxsw@mellanox.com, sfr@canb.auug.org.au, arnd@arndb.de Subject: [patch net-next v2] net: sched: silence uninitialized parent variable warning in tc_dump_tfilter Date: Thu, 18 Jan 2018 16:14:49 +0100 Message-Id: <20180118151449.2803-1-jiri@resnulli.us> X-Mailer: git-send-email 2.14.3 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Jiri Pirko When tcm->tcm_ifindex == TCM_IFINDEX_MAGIC_BLOCK, parent is still passed down but the value is never used. Compiler does not recognize it and issues a warning. Silence it down initializing parent to 0. Fixes: 7960d1daf278 ("net: sched: use block index as a handle instead of qdisc when block is shared") Reported-by: David Miller Reported-by: Stephen Rothwell Signed-off-by: Jiri Pirko --- v1->v2: - add comment about why the initialization to 0 is ok - move the initialization into the if block to be near the comment --- net/sched/cls_api.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c index e500d11da9cd..86d6e9d2cf00 100644 --- a/net/sched/cls_api.c +++ b/net/sched/cls_api.c @@ -1317,6 +1317,13 @@ static int tc_dump_tfilter(struct sk_buff *skb, struct netlink_callback *cb) block = tcf_block_lookup(net, tcm->tcm_block_index); if (!block) goto out; + /* If we work with block index, q is NULL and parent value + * will never be used in the following code. The check + * in tcf_fill_node prevents it. However, compiler does not + * see that far, so set parent to zero to silence the warning + * about parent being uninitialized. + */ + parent = 0; } else { const struct Qdisc_class_ops *cops; struct net_device *dev;