Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp4629782imm; Tue, 11 Sep 2018 15:15:18 -0700 (PDT) X-Google-Smtp-Source: ANB0VdY0q88y6hQWNNdvKyW1wmtcklpsgaNU3rcCHiECtsU5dkE7Bll78iVXy4v3FnnYyRcjj9X6 X-Received: by 2002:a17:902:8308:: with SMTP id bd8-v6mr29208168plb.134.1536704118824; Tue, 11 Sep 2018 15:15:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536704118; cv=none; d=google.com; s=arc-20160816; b=a7OYB8nvfQ+BoZXhI1pVbdYmfyB605DHrNEHNcntkG4aimDGeK8Xr4bHPXVT+h341Z ijXMcfQXICifuOFNP5u/UQVSTnSr9rbGucLl2lEMxT4M6HunNpRbFxaODiXTSl/0lzH4 o9pIYcS0nrqBLlSmSuICIW+pWBiRIPH/wUXExteIN/7aqFzsdyq4leIse3Yw/yS4zuyM ao1GSwH6qC4pDscmJXsb9yD6lZcfO4uQPxDLFm9irWfeud13qd+zKthq+X/6/11E7D3b zJPNcxGZlwAth7Igu25GToFYfB7XXfiX6d65sFOgv1o8E5x95bba4qQOVfVZP63TSKpY kYyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Gn9LPKxAdbOFeosTNmLgoD68w/wDjzgz9vhdf8pSbf0=; b=h4kadbiVt8ReXHwVmpVxdto3VgO5CBGwSsj6uVjHnTcjwtC06GvJ6/4AjLH0/fnw4u PsD6Vy8wln8uGSN9ZjB1xIL9Zcbvf+4JuocQGT/cOyvvVbvdz23kED8fkTK47utIN1/2 Hm9JWTCuy2xNVqMogujeZurArV9irz+La+bAkKQB4H/H05zP8TNbkfz8XUImvYslTwIz 8W4ywxYiNx5PQeRKs5s/2Fv7CPAq+ne7rQ+gOcGmEGgCeBJUv4M/SgNe/PpDewJ3paKE 3mVabXcn5u/c96a/ZUH5XcAODi6h//QtxwT6VZG1Igj2ZTajv5UOFEKS12otcfshS3gn GQ9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Y1buQGvn; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e205-v6si21014075pfh.158.2018.09.11.15.14.58; Tue, 11 Sep 2018 15:15:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Y1buQGvn; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728300AbeILDOx (ORCPT + 99 others); Tue, 11 Sep 2018 23:14:53 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:46251 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727796AbeILDOx (ORCPT ); Tue, 11 Sep 2018 23:14:53 -0400 Received: by mail-pg1-f194.google.com with SMTP id b129-v6so12918998pga.13; Tue, 11 Sep 2018 15:13:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=Gn9LPKxAdbOFeosTNmLgoD68w/wDjzgz9vhdf8pSbf0=; b=Y1buQGvn8tqSv6LuKCWnhQso1Xmj12FcY41q5RCtuzYvhew/3yxVMzvEj0LXo5HAvX q87Hz/2QWLa7ai65F9YUIvk57klyqFgqWcKb8Kro8ypcmP2Iq8JROJPZGwKhaYOYECXk MZE6UISMIhY+2D4MoRrz1PiHYtXMXVs2Mntmn92WzTLzLXc+1SFdc2OkwK8sFPNTg9R0 A3prpjY9AwkUP9czpBhpu1CAlLGqjh6hlTzDbQUtoSxPSi2/coqy1vexOTQNbwTF56ps 5C2cuo1LmEL+pMuepDgTNZCCFOPrUC/D/yq3eVzHsgrp/Ut+qxC2LMgL0eocm0f031i1 SNkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=Gn9LPKxAdbOFeosTNmLgoD68w/wDjzgz9vhdf8pSbf0=; b=bp6ERP3I6fuWx8fLhx1pzQF0rtGlf4IkW6HCEGcUgU/XtteQGoer9yPDaqvvzD6wKa 4c8RFEkeEUmFvmDrH+YtZLApu3rp5R4WXInymw444MI43oMbWjv3YNRp2SiLypAti2XU 3afn8+E/zFxN8Uk7IcxE/4uL9W1D669SegLwHWhEgzG0++kOSpQtoiiYerT5Ie4MObXn LAOsbm84WY2Q6GTHrBvL6pd70Yv7J2H9GSbvyNaJ+QMze+mSRTPI0Odfn+who/ityzAT OP7fC+Sz/pOwiFGDA1yA8jo7PElkVe6VGD87MHnVEN6Nedbhioahi3INzLJHIXbptcgk LXaA== X-Gm-Message-State: APzg51CuV1xJmfUBrMAbKi78IbDjOYqjrEPVYlgFf1kU4BLCIBvQB8S7 oNDgShVBj3CEjuudQhuja9w= X-Received: by 2002:a62:89d8:: with SMTP id n85-v6mr31606146pfk.83.1536704010526; Tue, 11 Sep 2018 15:13:30 -0700 (PDT) Received: from ast-mbp ([2620:10d:c090:200::4:2d48]) by smtp.gmail.com with ESMTPSA id 9-v6sm32752015pfc.20.2018.09.11.15.13.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Sep 2018 15:13:29 -0700 (PDT) Date: Tue, 11 Sep 2018 15:13:28 -0700 From: Alexei Starovoitov To: Anders Roxell Cc: davem@davemloft.net, ast@kernel.org, daniel@iogearbox.net, tehnerd@fb.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] net/core/filter: fix unused-variable warning Message-ID: <20180911221326.cwsf6rfpkhvoywhw@ast-mbp> References: <20180907125005.32383-1-anders.roxell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20180907125005.32383-1-anders.roxell@linaro.org> User-Agent: NeoMutt/20180223 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 07, 2018 at 02:50:05PM +0200, Anders Roxell wrote: > Building with CONFIG_INET=n will show the warning below: > net/core/filter.c: In function ‘____bpf_getsockopt’: > net/core/filter.c:4048:19: warning: unused variable ‘tp’ [-Wunused-variable] > struct tcp_sock *tp; > ^~ > net/core/filter.c:4046:31: warning: unused variable ‘icsk’ [-Wunused-variable] > struct inet_connection_sock *icsk; > ^~~~ > Move the variable declarations inside the {} block where they are used. > > Fixes: 1e215300f138 ("bpf: add TCP_SAVE_SYN/TCP_SAVED_SYN options for bpf_(set|get)sockopt") > Signed-off-by: Anders Roxell > --- > net/core/filter.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/net/core/filter.c b/net/core/filter.c > index d301134bca3a..0ae7185b2207 100644 > --- a/net/core/filter.c > +++ b/net/core/filter.c > @@ -4043,14 +4043,14 @@ static const struct bpf_func_proto bpf_setsockopt_proto = { > BPF_CALL_5(bpf_getsockopt, struct bpf_sock_ops_kern *, bpf_sock, > int, level, int, optname, char *, optval, int, optlen) > { > - struct inet_connection_sock *icsk; > struct sock *sk = bpf_sock->sk; > - struct tcp_sock *tp; > > if (!sk_fullsock(sk)) > goto err_clear; > #ifdef CONFIG_INET > if (level == SOL_TCP && sk->sk_prot->getsockopt == tcp_getsockopt) { > + struct inet_connection_sock *icsk; > + struct tcp_sock *tp; > switch (optname) { I've added empty line after variable decl and applied.