Received: by 10.213.65.68 with SMTP id h4csp136248imn; Wed, 21 Mar 2018 14:25:11 -0700 (PDT) X-Google-Smtp-Source: AG47ELs4bdujgkEXmWzvjGx00cercLgCF7NI9Onoas/hwXSWWiTh9Or/3IkK1UL3Jyk4TMoFNkqs X-Received: by 10.99.160.67 with SMTP id u3mr15679874pgn.389.1521667511899; Wed, 21 Mar 2018 14:25:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521667511; cv=none; d=google.com; s=arc-20160816; b=PcfksGPhyVG1hYoh8U2BLWQzN53yy1E1IG5CoNGT/zXrbcWfhBGJSZzzV1iNPA+gS8 PLnQL0tpWiD7OIVHiQN78eJSUzJb9AQJ6x9L1FPLJpt7iMEcnLrJBFp7nQ011IqFTPrz MZTmmE+5tPib9zc7Cgkw7OaV0np5gOu8eDbKgfEMKud35PwOaAWSAE6mMLGX4/TRxH8E tZ9xUUo95NfoZAwsw2QIDOCgU1Qy2p3aax+e4uxzakHwxXysYjriC/mJqmr2JKayyirN GcgtiJ7pdaGg3SlvavpsnKgkX1CU503meOwP3EHJERs9jbhJGR5fCmCClc9XhCwWA58h P2+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=zCbRYIIs9IFQQUzIwtbI4HQB074tnvPsQqElZVNq4R8=; b=nnpYz3eV/4ZLCCq3nhG8MTN9VywCCkzjYn0pdKPBzdtpeAIAnmHAY7yLzFH1ggbOSQ ONkHgZR3IaW+acvQ1Q/Xd2vZY7DEP/zxOM+zaV0c6qVG0hz04iqO8G1+e3Pfy1glTHOW D6kn9cVdajNFu6GqFyqMz1xBm/WEs+ceRbDXw3ca3qF43IESoQy/+Dnp9OqyqJnE6M3y p1fyh2kaLGHddRmAgaM9FXFA9S12AfdgVYEN/pgU5Lpt2Nyvha1B9bZbrhHv2dLet3I3 W1D4E8TNV46XvZntbOf6xqhbeM//FYQkB5fVuqSq9yxvKwZEjnEBD9AbVXLKyrk4WlY/ bZ6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=fo7vWeOf; 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 d92-v6si4679444pld.383.2018.03.21.14.24.57; Wed, 21 Mar 2018 14:25:11 -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=fo7vWeOf; 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 S1753750AbeCUVXI (ORCPT + 99 others); Wed, 21 Mar 2018 17:23:08 -0400 Received: from mail-qt0-f196.google.com ([209.85.216.196]:40910 "EHLO mail-qt0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753210AbeCUVXE (ORCPT ); Wed, 21 Mar 2018 17:23:04 -0400 Received: by mail-qt0-f196.google.com with SMTP id y6so6852900qtm.7; Wed, 21 Mar 2018 14:23:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=zCbRYIIs9IFQQUzIwtbI4HQB074tnvPsQqElZVNq4R8=; b=fo7vWeOfx49CJ2B7n3v1a1gtvpjbCVFye5NsKZwUeC+VfG4PXq3K5RLV3RmVAKzDHg FUI/fGnFPPSwk7R2MsvX+ZJcKy0zaUWwZW1SLiMRZsFg10aazbdEb8uAxEWrJWYv5/He zCrIp2f4Ccd8G8fARn1F89DXBXnUDS/amFEvA6uqEs9Vge8KvX5/k9B9jTTsiyoFSTRx MpmCkmq7J25YfDEvHulz2+e4laJSZng34qZdiPgwtK+f6iRkrGB7ADSbkBd2mcnVZ8bl c9ZkoyUl2NgmdPCEKLTqhg1HPjo740ZOSy/CcgqR8be2Gn5INmoc6KoSGKJ0IesWV7Q6 rKNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=zCbRYIIs9IFQQUzIwtbI4HQB074tnvPsQqElZVNq4R8=; b=diebKgVUWsQznk2eKn4ewXfQUsNWbgcYVn8+Hceia/dVoD+ET3PDRV8HSi3Ufq38tN fvWif/qvBCyzwJJEdXqjAFiJG6gB4cp59Qwa21tPF70Kjex51/VdA9TA4DK5q6el1Dqn UvdSV/LJeZmdpdmKCNOvSrOzkMXUMgaPgtk+YHbVgzHzsHGeR4Wq437UJzA/F7eVwi/w +6eYtM4RMhjl06XTkL6ViQBW68k8JvW6IkKYcbLkJssqF9O1LOKN9juF7Tzv/EIYbZzI q4uxdMsmsRWGFBpKBOjV2DSu1YgI9ws6a5pYWWnCCze4R124tootPaMxtxi5fIpViPya lZAg== X-Gm-Message-State: AElRT7HwuwBf8R0tJnJoxO6GiMee0pVnheQYCZ/m4KKYPj3RRkijDkla 17vzCW8UYnTRfxuPikssNUwXWKGwbaxAg11ybFw= X-Received: by 10.237.32.39 with SMTP id 36mr31517547qta.74.1521667383897; Wed, 21 Mar 2018 14:23:03 -0700 (PDT) MIME-Version: 1.0 Received: by 10.237.36.154 with HTTP; Wed, 21 Mar 2018 14:22:23 -0700 (PDT) In-Reply-To: <20180321193458.4451-1-colin.king@canonical.com> References: <20180321193458.4451-1-colin.king@canonical.com> From: William Tu Date: Wed, 21 Mar 2018 14:22:23 -0700 Message-ID: Subject: Re: [PATCH][next] gre: fix TUNNEL_SEQ bit check on sequence numbering To: Colin King Cc: "David S . Miller" , Alexey Kuznetsov , Hideaki YOSHIFUJI , Linux Kernel Network Developers , kernel-janitors@vger.kernel.org, LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 21, 2018 at 12:34 PM, Colin King wrote: > From: Colin Ian King > > The current logic of flags | TUNNEL_SEQ is always non-zero and hence > sequence numbers are always incremented no matter the setting of the > TUNNEL_SEQ bit. Fix this by using & instead of |. > > Detected by CoverityScan, CID#1466039 ("Operands don't affect result") > > Fixes: 77a5196a804e ("gre: add sequence number for collect md mode.") > Signed-off-by: Colin Ian King Thanks for the fix! btw, how can I access the CoverityScan result with this CID? Acked-by: William Tu > --- > net/ipv4/ip_gre.c | 2 +- > net/ipv6/ip6_gre.c | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c > index 2fa2ef2e2af9..9ab1aa2f7660 100644 > --- a/net/ipv4/ip_gre.c > +++ b/net/ipv4/ip_gre.c > @@ -550,7 +550,7 @@ static void gre_fb_xmit(struct sk_buff *skb, struct net_device *dev, > (TUNNEL_CSUM | TUNNEL_KEY | TUNNEL_SEQ); > gre_build_header(skb, tunnel_hlen, flags, proto, > tunnel_id_to_key32(tun_info->key.tun_id), > - (flags | TUNNEL_SEQ) ? htonl(tunnel->o_seqno++) : 0); > + (flags & TUNNEL_SEQ) ? htonl(tunnel->o_seqno++) : 0); > > df = key->tun_flags & TUNNEL_DONT_FRAGMENT ? htons(IP_DF) : 0; > > diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c > index 0bcefc480aeb..3a98c694da5f 100644 > --- a/net/ipv6/ip6_gre.c > +++ b/net/ipv6/ip6_gre.c > @@ -725,7 +725,7 @@ static netdev_tx_t __gre6_xmit(struct sk_buff *skb, > gre_build_header(skb, tunnel->tun_hlen, > flags, protocol, > tunnel_id_to_key32(tun_info->key.tun_id), > - (flags | TUNNEL_SEQ) ? htonl(tunnel->o_seqno++) > + (flags & TUNNEL_SEQ) ? htonl(tunnel->o_seqno++) > : 0); > > } else { > -- > 2.15.1 >