From patchwork Sat Mar 23 16:01:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Willem de Bruijn X-Patchwork-Id: 1062325 Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@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; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="NVBP3eb4"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 44RQJ33sm4z9sST for ; Sun, 24 Mar 2019 03:01:38 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727494AbfCWQBg (ORCPT ); Sat, 23 Mar 2019 12:01:36 -0400 Received: from mail-qt1-f196.google.com ([209.85.160.196]:43319 "EHLO mail-qt1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727298AbfCWQBg (ORCPT ); Sat, 23 Mar 2019 12:01:36 -0400 Received: by mail-qt1-f196.google.com with SMTP id v32so5856291qtc.10 for ; Sat, 23 Mar 2019 09:01:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=WaIKwRNi3DTodLCrvNssNAgbCr8mqJEKbcgFB3RsbD4=; b=NVBP3eb4D+vR1AAhcZoQjdVe7q69X+rFpz4COrbgMK8Pq4TcxsL3dSrnbWT7Iy0LoA g7f/ggcqkUnAVpwZFPbSWIiSsl7btBOu3WOYnAIvDiG7yzNuo5u+/Z7h8fKzT5wppTM3 1trASfu3FMoy/m62OfmtW3o7DFDyDioumgDalowZwqluQw7pPQnzd4vq9D52gMzelsns IeRQsHjbEVah73pZNkTrJ1h8KOqchBkxJOaDwBBQjCP5L369cEfSXc3EGNP6LJ1FHj0l NoHNJRwdzYSuFlB1YRcCzfTeoslDReoLRnxWTBYGGYSbsybzmQUk8Y82T+aDuKm1Pt3W ndHw== 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:mime-version :content-transfer-encoding; bh=WaIKwRNi3DTodLCrvNssNAgbCr8mqJEKbcgFB3RsbD4=; b=PyBEIfSi2GNc3L/MFrS5sEdfiIKEJY8PUUjQMWlntvAUu5axUPL31mCW0TZ01Q6frW JE4kSFpR/G+pqGoO58WXKl55xHsd+idvyXumbYpjQ6Vu0FnNXT0p9QWVgvvMXLG34kXF kMhsD32tiaJmP7pnjsxvLnN9Naw0cRmyn6tup7RWi3b8Qy+ZDV8jSPLZdFufN4V4zEcs 1JtcaZiadXlwHfCMSij1WS0E4bAEsghxoaEhxPgiPe8F3KTaluAYJHfF8Jp3rFuwvg43 udrwFKw5lEqwFhn0cEDX+EKRj3ldCtpWByna+bn5JJuFtTulxSvgiyo+lsWL0AFViOfJ e7dw== X-Gm-Message-State: APjAAAV30B4FNCJUyPMrTXHbjHXyYrit2a8xALR6GmtTYkRDhmyrQxHH q7pItiqleIfCk8CbnI2vH1wAoF05 X-Google-Smtp-Source: APXvYqxCaJ1GOBbtEriwGpIgfCcohxsQmX6kZ9n8icMkCyZV2ufxLzdlLwlVsZEim8pJXeNRpEX5wA== X-Received: by 2002:aed:22db:: with SMTP id q27mr6256294qtc.203.1553356895181; Sat, 23 Mar 2019 09:01:35 -0700 (PDT) Received: from willemb1.nyc.corp.google.com ([2620:0:1003:315:3fa1:a34c:1128:1d39]) by smtp.gmail.com with ESMTPSA id u16sm11185175qtc.84.2019.03.23.09.01.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 23 Mar 2019 09:01:34 -0700 (PDT) From: Willem de Bruijn To: netdev@vger.kernel.org Cc: ast@kernel.org, daniel@iogearbox.net, Willem de Bruijn , kbuild test robot Subject: [PATCH bpf-next] bpf: silence uninitialized var warning in bpf_skb_net_grow Date: Sat, 23 Mar 2019 12:01:31 -0400 Message-Id: <20190323160131.230220-1-willemdebruijn.kernel@gmail.com> X-Mailer: git-send-email 2.21.0.392.gf8f6787159e-goog MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Willem de Bruijn These three variables are set in one branch and used in another with the same condition. But on some architectures they still generate compiler warnings of the kind: warning: 'inner_trans' may be used uninitialized in this function [-Wmaybe-uninitialized] Silence these false positives. Use the straightforward approach to always initialize them, if a bit superfluous. Fixes: 868d523535c2 ("add bpf_skb_adjust_room encap flags") Reported-by: kbuild test robot Signed-off-by: Willem de Bruijn --- net/core/filter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/core/filter.c b/net/core/filter.c index 0a972fbf60df..22eb2edf5573 100644 --- a/net/core/filter.c +++ b/net/core/filter.c @@ -2975,8 +2975,8 @@ static int bpf_skb_net_grow(struct sk_buff *skb, u32 off, u32 len_diff, u64 flags) { bool encap = flags & BPF_F_ADJ_ROOM_ENCAP_L3_MASK; + u16 mac_len = 0, inner_net = 0, inner_trans = 0; unsigned int gso_type = SKB_GSO_DODGY; - u16 mac_len, inner_net, inner_trans; int ret; if (skb_is_gso(skb) && !skb_is_gso_tcp(skb)) {