diff mbox series

[ovs-dev,v1,1/3] conntrack: Fix clang static analysis reports.

Message ID 1505879948-112145-1-git-send-email-dlu998@gmail.com
State Superseded
Headers show
Series [ovs-dev,v1,1/3] conntrack: Fix clang static analysis reports. | expand

Commit Message

Darrell Ball Sept. 20, 2017, 3:59 a.m. UTC
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 <bhanuprakash.bodireddy@intel.com>
Signed-off-by: Darrell Ball <dlu998@gmail.com>
---
 lib/conntrack.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)
diff mbox series

Patch

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 {