From patchwork Wed Sep 20 03:59:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Darrell Ball X-Patchwork-Id: 815998 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="nWhMn+oQ"; dkim-atps=neutral Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xxmG824DPz9s2G for ; Wed, 20 Sep 2017 13:59:28 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 9774ECB0; Wed, 20 Sep 2017 03:59:19 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 6502FC33 for ; Wed, 20 Sep 2017 03:59:18 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pf0-f195.google.com (mail-pf0-f195.google.com [209.85.192.195]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id E12E4469 for ; Wed, 20 Sep 2017 03:59:17 +0000 (UTC) Received: by mail-pf0-f195.google.com with SMTP id f84so706114pfj.3 for ; Tue, 19 Sep 2017 20:59:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id; bh=NweoReEhh+/HxH0Ru5r9wXsjz50Cz8SSoKaFSjqTzmg=; b=nWhMn+oQyP5mpOfluAUuvhf6p9OpOpOyC6cya2AjsJgxMUXIifWU2gMppcvidLe2qY CdS+qS5LOgipiV8HOtAGxExoYBp7BKAvULhqHnH/clZHGX13EJ94fS3oIJX+PsXtrc46 XMGPNGu5S0wp2AE5j0oQkfYnqeBSPc9qFclI12DyEN69WjEE+HAnFDMc+8Y3F4sn6HVK bOVwDCIbUmxVIiPX5nHgDi5tcTvu/t/6QT6sgM7YX+zb6pjzlpQ6DLldt2QCfLjR4Q3z 8gsYTbazW5K28uehgFyV/g6f24Ka/2bdVcx8vwAu22aNoJJE4EbrMbXEmAxKzUmJrFMf B5DA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=NweoReEhh+/HxH0Ru5r9wXsjz50Cz8SSoKaFSjqTzmg=; b=HTTl1eDl8b0573Zlsi/O/OEg/YEdQnGpJqLuIL1BMmXTKVN2NVziKmI9CRNmFt1wdk 1MrLy4Y4JXEmxOvqrTQwIbuV/6q0PrCN5dg0Z4HL4at16SvZUmXVDnJ4vskpgNNi9R3h 2xA0uCAwyRhaFqYhFrOv0dePmE0DVXcTqKbyvKB9XNs54BXfHDSJlovf1Q8+XKycErH+ xwZYow4u6e3hZZc2Q7TTHfKMh/9vrwrnXFzJDEa8AunCEUjr1hgCNEoha8XANQ1at0M1 w+DWEcfYCxi8D+VVnZxuHEU/Y/V7u6SamSbIVcsa46wj3LEqU172WlFQ0/BFbL6H0z0c rBWA== X-Gm-Message-State: AHPjjUh1oB0lgSS1boPOmVaJwlSXmRygcZ3TL0pxuWp/VMXULtA7rMhI tkL0leG3odE+XHNKmAe2ShU= X-Google-Smtp-Source: AOwi7QA3sRNlZ1m2tZxH5G5URgMHx0PSwSS6+k0NdS3fLJHKSvzUfqI9C4C4kc/gixP0AyJdAOwj3g== X-Received: by 10.98.74.4 with SMTP id x4mr793774pfa.222.1505879957525; Tue, 19 Sep 2017 20:59:17 -0700 (PDT) Received: from ubuntu.localdomain ([208.91.2.2]) by smtp.gmail.com with ESMTPSA id 195sm4983033pgg.42.2017.09.19.20.59.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 19 Sep 2017 20:59:17 -0700 (PDT) From: Darrell Ball To: dlu998@gmail.com, dev@openvswitch.org Date: Tue, 19 Sep 2017 20:59:06 -0700 Message-Id: <1505879948-112145-1-git-send-email-dlu998@gmail.com> X-Mailer: git-send-email 1.9.1 X-Spam-Status: No, score=0.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM autolearn=disabled version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [patch v1 1/3] conntrack: Fix clang static analysis reports. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org These warnings do not affect functionality. In one case, a local variable could be removed and in another case, the working pointer should be used rather than the start pointer. Fixes: bd5e81a0e596 ("Userspace Datapath: Add ALG infra and FTP.") Reported-by: Bhanuprakash Bodireddy Signed-off-by: Darrell Ball --- lib/conntrack.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/lib/conntrack.c b/lib/conntrack.c index 419cb1d..59d3c4e 100644 --- a/lib/conntrack.c +++ b/lib/conntrack.c @@ -2617,7 +2617,7 @@ process_ftp_ctl_v4(struct conntrack *ct, char *ftp = ftp_msg; enum ct_alg_mode mode; - if (!strncasecmp(ftp_msg, FTP_PORT_CMD, strlen(FTP_PORT_CMD))) { + if (!strncasecmp(ftp, FTP_PORT_CMD, strlen(FTP_PORT_CMD))) { ftp = ftp_msg + strlen(FTP_PORT_CMD); mode = CT_FTP_MODE_ACTIVE; } else { @@ -2763,7 +2763,7 @@ process_ftp_ctl_v6(struct conntrack *ct, char *ftp = ftp_msg; struct in6_addr ip6_addr; - if (!strncasecmp(ftp_msg, FTP_EPRT_CMD, strlen(FTP_EPRT_CMD))) { + if (!strncasecmp(ftp, FTP_EPRT_CMD, strlen(FTP_EPRT_CMD))) { ftp = ftp_msg + strlen(FTP_EPRT_CMD); ftp = skip_non_digits(ftp); if (*ftp != FTP_AF_V6 || isdigit(ftp[1])) { @@ -2906,10 +2906,8 @@ handle_ftp_ctl(struct conntrack *ct, const struct conn_lookup_ctx *ctx, struct ovs_16aligned_ip6_hdr *nh6 = dp_packet_l3(pkt); int64_t seq_skew = 0; - bool seq_skew_dir; if (ftp_ctl == CT_FTP_CTL_OTHER) { seq_skew = conn_for_expectation->seq_skew; - seq_skew_dir = conn_for_expectation->seq_skew_dir; } else if (ftp_ctl == CT_FTP_CTL_INTEREST) { enum ftp_ctl_pkt rc; if (ctx->key.dl_type == htons(ETH_TYPE_IPV6)) { @@ -2933,18 +2931,16 @@ handle_ftp_ctl(struct conntrack *ct, const struct conn_lookup_ctx *ctx, seq_skew = repl_ftp_v6_addr(pkt, v6_addr_rep, ftp_data_start, addr_offset_from_ftp_data_start, addr_size, mode); - seq_skew_dir = ctx->reply; if (seq_skew) { ip_len = ntohs(nh6->ip6_ctlun.ip6_un1.ip6_un1_plen); ip_len += seq_skew; nh6->ip6_ctlun.ip6_un1.ip6_un1_plen = htons(ip_len); conn_seq_skew_set(ct, &conn_for_expectation->key, now, - seq_skew, seq_skew_dir); + seq_skew, ctx->reply); } } else { seq_skew = repl_ftp_v4_addr(pkt, v4_addr_rep, ftp_data_start, addr_offset_from_ftp_data_start); - seq_skew_dir = ctx->reply; ip_len = ntohs(l3_hdr->ip_tot_len); if (seq_skew) { ip_len += seq_skew; @@ -2952,7 +2948,7 @@ handle_ftp_ctl(struct conntrack *ct, const struct conn_lookup_ctx *ctx, l3_hdr->ip_tot_len, htons(ip_len)); l3_hdr->ip_tot_len = htons(ip_len); conn_seq_skew_set(ct, &conn_for_expectation->key, now, - seq_skew, seq_skew_dir); + seq_skew, ctx->reply); } } } else {