From patchwork Tue Apr 27 20:43:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pablo Neira Ayuso X-Patchwork-Id: 427963 Delivered-To: patch@linaro.org Received: by 2002:a02:c901:0:0:0:0:0 with SMTP id t1csp4970276jao; Tue, 27 Apr 2021 13:44:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwcJlrDuhP73gavNUbnuLHuPMlEZeURA7tdpe6Y04xdtdE4mDbfWeyXn8tQj2QdNv+xRDTQ X-Received: by 2002:a17:907:3e06:: with SMTP id hp6mr24972260ejc.273.1619556241064; Tue, 27 Apr 2021 13:44:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619556241; cv=none; d=google.com; s=arc-20160816; b=fgew4J458+REZWI5wwdy/xu6vI74KowPOpC341MyfQbArLbpigFglyi8IR8RdYFSWb 8lfJYiWeg7Y7I5iNx1/QSCv/akTjWQoF49LqAHnxFuGJjCEiGuuEo2J8jTPSFRNi5MTt TTlTOWNng5PDy5R3oGy5inbeQm+Po82orM0rEbqUGejIrt5n95DXoSlxC1LRqcgguh+3 YwwcCt1u5P8cZuJH7c9ZclhaBe4K6uLAOsnizZ7CnGeEBU7sQSpYYWuwlR8c9MnhnzxF lIaf1qFlDl12nXcl3UPhuP6LEZYzFo/bzCJoJK5TIvqifaWFCvg29qCNnWtddnHt33pF F6OQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=Oc7prjL0856pZKuTGaETUjvxN6HG34s+FjBTgEgQeY8=; b=EbLsv85IWBgHMS358xvPAVNdMuRXa7tVmGh8uKqs7sj/YojTmDtqfHxpVF3fiVkLis xnp2Uq6VtbDab5QgTUZoQo87mLZuUYNVau2EcwLy1Guk+v4ealnxaW1FQHifQjcDtcyy wDzJRq205Hk6swm6XZIgH8keo6cGM12gLTSNvH27lmrq4VyoI8yzYa7KseW/9eQ+bDw4 3mM0tXHh9c05WQzM8HQNBEzkXCghiR+UVL5p/kKKC/OazB+MT4kbgRvbxeL5CZYJcuer fhUqYJ9b4To+EnV/HxFB5MMQ1Z+ssGzjAbZ+rHyUrcebQZoSGsvCuusJmMiTw/RHo7ww kq6A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g4si831651ejj.279.2021.04.27.13.44.00; Tue, 27 Apr 2021 13:44:01 -0700 (PDT) Received-SPF: pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239041AbhD0Uon (ORCPT + 8 others); Tue, 27 Apr 2021 16:44:43 -0400 Received: from mail.netfilter.org ([217.70.188.207]:54336 "EHLO mail.netfilter.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238992AbhD0Uoj (ORCPT ); Tue, 27 Apr 2021 16:44:39 -0400 Received: from localhost.localdomain (unknown [90.77.255.23]) by mail.netfilter.org (Postfix) with ESMTPSA id 3C35D64143; Tue, 27 Apr 2021 22:43:18 +0200 (CEST) From: Pablo Neira Ayuso To: netfilter-devel@vger.kernel.org Cc: davem@davemloft.net, netdev@vger.kernel.org, kuba@kernel.org Subject: [PATCH net-next 6/7] netfilter: nft_socket: fix an unused variable warning Date: Tue, 27 Apr 2021 22:43:44 +0200 Message-Id: <20210427204345.22043-7-pablo@netfilter.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210427204345.22043-1-pablo@netfilter.org> References: <20210427204345.22043-1-pablo@netfilter.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Arnd Bergmann The variable is only used in an #ifdef, causing a harmless warning: net/netfilter/nft_socket.c: In function 'nft_socket_init': net/netfilter/nft_socket.c:137:27: error: unused variable 'level' [-Werror=unused-variable] 137 | unsigned int len, level; | ^~~~~ Move it into the same #ifdef block. Fixes: e0bb96db96f8 ("netfilter: nft_socket: add support for cgroupsv2") Signed-off-by: Arnd Bergmann Signed-off-by: Pablo Neira Ayuso --- net/netfilter/nft_socket.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) -- 2.30.2 diff --git a/net/netfilter/nft_socket.c b/net/netfilter/nft_socket.c index 9c169d100651..f9c5ff6024e0 100644 --- a/net/netfilter/nft_socket.c +++ b/net/netfilter/nft_socket.c @@ -134,7 +134,7 @@ static int nft_socket_init(const struct nft_ctx *ctx, const struct nlattr * const tb[]) { struct nft_socket *priv = nft_expr_priv(expr); - unsigned int len, level; + unsigned int len; if (!tb[NFTA_SOCKET_DREG] || !tb[NFTA_SOCKET_KEY]) return -EINVAL; @@ -160,7 +160,9 @@ static int nft_socket_init(const struct nft_ctx *ctx, len = sizeof(u32); break; #ifdef CONFIG_CGROUPS - case NFT_SOCKET_CGROUPV2: + case NFT_SOCKET_CGROUPV2: { + unsigned int level; + if (!tb[NFTA_SOCKET_LEVEL]) return -EINVAL; @@ -171,6 +173,7 @@ static int nft_socket_init(const struct nft_ctx *ctx, priv->level = level; len = sizeof(u64); break; + } #endif default: return -EOPNOTSUPP;