Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.2/patches/809466/?format=api
{ "id": 809466, "url": "http://patchwork.ozlabs.org/api/1.2/patches/809466/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/patch/1504478435-13160-9-git-send-email-pablo@netfilter.org/", "project": { "id": 7, "url": "http://patchwork.ozlabs.org/api/1.2/projects/7/?format=api", "name": "Linux network development", "link_name": "netdev", "list_id": "netdev.vger.kernel.org", "list_email": "netdev@vger.kernel.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<1504478435-13160-9-git-send-email-pablo@netfilter.org>", "list_archive_url": null, "date": "2017-09-03T22:40:19", "name": "[31/47] netfilter: nf_nat_h323: fix logical-not-parentheses warning", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "0501b2824dec8130ea00d3abf430a9eabe934fe4", "submitter": { "id": 1315, "url": "http://patchwork.ozlabs.org/api/1.2/people/1315/?format=api", "name": "Pablo Neira Ayuso", "email": "pablo@netfilter.org" }, "delegate": { "id": 34, "url": "http://patchwork.ozlabs.org/api/1.2/users/34/?format=api", "username": "davem", "first_name": "David", "last_name": "Miller", "email": "davem@davemloft.net" }, "mbox": "http://patchwork.ozlabs.org/project/netdev/patch/1504478435-13160-9-git-send-email-pablo@netfilter.org/mbox/", "series": [ { "id": 1283, "url": "http://patchwork.ozlabs.org/api/1.2/series/1283/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/list/?series=1283", "date": "2017-09-03T22:40:11", "name": null, "version": 1, "mbox": "http://patchwork.ozlabs.org/series/1283/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/809466/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/809466/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<netdev-owner@vger.kernel.org>", "X-Original-To": "patchwork-incoming@ozlabs.org", "Delivered-To": "patchwork-incoming@ozlabs.org", "Authentication-Results": "ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=netdev-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)", "Received": [ "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xlp3G44S5z9s06\n\tfor <patchwork-incoming@ozlabs.org>;\n\tMon, 4 Sep 2017 08:45:30 +1000 (AEST)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1753188AbdICWp2 (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tSun, 3 Sep 2017 18:45:28 -0400", "from mail.us.es ([193.147.175.20]:52750 \"EHLO mail.us.es\"\n\trhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP\n\tid S1753302AbdICWk7 (ORCPT <rfc822;netdev@vger.kernel.org>);\n\tSun, 3 Sep 2017 18:40:59 -0400", "from antivirus1-rhel7.int (unknown [192.168.2.11])\n\tby mail.us.es (Postfix) with ESMTP id F1BDF190F6C\n\tfor <netdev@vger.kernel.org>; Mon, 4 Sep 2017 00:40:31 +0200 (CEST)", "from antivirus1-rhel7.int (localhost [127.0.0.1])\n\tby antivirus1-rhel7.int (Postfix) with ESMTP id E396AB5059\n\tfor <netdev@vger.kernel.org>; Mon, 4 Sep 2017 00:40:31 +0200 (CEST)", "by antivirus1-rhel7.int (Postfix, from userid 99)\n\tid D9519B5028; Mon, 4 Sep 2017 00:40:31 +0200 (CEST)", "from antivirus1-rhel7.int (localhost [127.0.0.1])\n\tby antivirus1-rhel7.int (Postfix) with ESMTP id C4F9FB502C;\n\tMon, 4 Sep 2017 00:40:29 +0200 (CEST)", "from 192.168.1.97 (192.168.1.97) by antivirus1-rhel7.int\n\t(F-Secure/fsigk_smtp/550/antivirus1-rhel7.int); \n\tMon, 04 Sep 2017 00:40:29 +0200 (CEST)", "from salvia.here (unknown [31.4.193.113])\n\t(Authenticated sender: 1984lsi)\n\tby entrada.int (Postfix) with ESMTPA id 720914265A20;\n\tMon, 4 Sep 2017 00:40:29 +0200 (CEST)" ], "X-Spam-Checker-Version": "SpamAssassin 3.4.1 (2015-04-28) on\n\tantivirus1-rhel7.int", "X-Spam-Level": "", "X-Spam-Status": "No, score=-108.2 required=7.5 tests=ALL_TRUSTED,BAYES_50,\n\tSMTPAUTH_US2,USER_IN_WHITELIST autolearn=disabled version=3.4.1", "X-Virus-Status": "clean(F-Secure/fsigk_smtp/550/antivirus1-rhel7.int)", "X-SMTPAUTHUS": "auth mail.us.es", "From": "Pablo Neira Ayuso <pablo@netfilter.org>", "To": "netfilter-devel@vger.kernel.org", "Cc": "davem@davemloft.net, netdev@vger.kernel.org", "Subject": "[PATCH 31/47] netfilter: nf_nat_h323: fix logical-not-parentheses\n\twarning", "Date": "Mon, 4 Sep 2017 00:40:19 +0200", "Message-Id": "<1504478435-13160-9-git-send-email-pablo@netfilter.org>", "X-Mailer": "git-send-email 2.1.4", "In-Reply-To": "<1504478435-13160-1-git-send-email-pablo@netfilter.org>", "References": "<1504478435-13160-1-git-send-email-pablo@netfilter.org>", "X-Virus-Scanned": "ClamAV using ClamSMTP", "Sender": "netdev-owner@vger.kernel.org", "Precedence": "bulk", "List-ID": "<netdev.vger.kernel.org>", "X-Mailing-List": "netdev@vger.kernel.org" }, "content": "From: Nick Desaulniers <ndesaulniers@google.com>\n\nClang produces the following warning:\n\nnet/ipv4/netfilter/nf_nat_h323.c:553:6: error:\nlogical not is only applied to the left hand side of this comparison\n [-Werror,-Wlogical-not-parentheses]\nif (!set_h225_addr(skb, protoff, data, dataoff, taddr,\n ^\nadd parentheses after the '!' to evaluate the comparison first\nadd parentheses around left hand side expression to silence this warning\n\nThere's not necessarily a bug here, but it's cleaner to return early,\nex:\n\nif (x)\n return\n...\n\nrather than:\n\nif (x == 0)\n ...\nelse\n return\n\nAlso added a return code check that seemed to be missing in one\ninstance.\n\nSigned-off-by: Nick Desaulniers <ndesaulniers@google.com>\nSigned-off-by: Pablo Neira Ayuso <pablo@netfilter.org>\n---\n net/ipv4/netfilter/nf_nat_h323.c | 57 +++++++++++++++++++++-------------------\n 1 file changed, 30 insertions(+), 27 deletions(-)", "diff": "diff --git a/net/ipv4/netfilter/nf_nat_h323.c b/net/ipv4/netfilter/nf_nat_h323.c\nindex 574f7ebba0b6..ac8342dcb55e 100644\n--- a/net/ipv4/netfilter/nf_nat_h323.c\n+++ b/net/ipv4/netfilter/nf_nat_h323.c\n@@ -252,16 +252,16 @@ static int nat_rtp_rtcp(struct sk_buff *skb, struct nf_conn *ct,\n \tif (set_h245_addr(skb, protoff, data, dataoff, taddr,\n \t\t\t &ct->tuplehash[!dir].tuple.dst.u3,\n \t\t\t htons((port & htons(1)) ? nated_port + 1 :\n-\t\t\t\t\t\t nated_port)) == 0) {\n-\t\t/* Save ports */\n-\t\tinfo->rtp_port[i][dir] = rtp_port;\n-\t\tinfo->rtp_port[i][!dir] = htons(nated_port);\n-\t} else {\n+\t\t\t\t\t\t nated_port))) {\n \t\tnf_ct_unexpect_related(rtp_exp);\n \t\tnf_ct_unexpect_related(rtcp_exp);\n \t\treturn -1;\n \t}\n \n+\t/* Save ports */\n+\tinfo->rtp_port[i][dir] = rtp_port;\n+\tinfo->rtp_port[i][!dir] = htons(nated_port);\n+\n \t/* Success */\n \tpr_debug(\"nf_nat_h323: expect RTP %pI4:%hu->%pI4:%hu\\n\",\n \t\t &rtp_exp->tuple.src.u3.ip,\n@@ -370,15 +370,15 @@ static int nat_h245(struct sk_buff *skb, struct nf_conn *ct,\n \t/* Modify signal */\n \tif (set_h225_addr(skb, protoff, data, dataoff, taddr,\n \t\t\t &ct->tuplehash[!dir].tuple.dst.u3,\n-\t\t\t htons(nated_port)) == 0) {\n-\t\t/* Save ports */\n-\t\tinfo->sig_port[dir] = port;\n-\t\tinfo->sig_port[!dir] = htons(nated_port);\n-\t} else {\n+\t\t\t htons(nated_port))) {\n \t\tnf_ct_unexpect_related(exp);\n \t\treturn -1;\n \t}\n \n+\t/* Save ports */\n+\tinfo->sig_port[dir] = port;\n+\tinfo->sig_port[!dir] = htons(nated_port);\n+\n \tpr_debug(\"nf_nat_q931: expect H.245 %pI4:%hu->%pI4:%hu\\n\",\n \t\t &exp->tuple.src.u3.ip,\n \t\t ntohs(exp->tuple.src.u.tcp.port),\n@@ -462,24 +462,27 @@ static int nat_q931(struct sk_buff *skb, struct nf_conn *ct,\n \t/* Modify signal */\n \tif (set_h225_addr(skb, protoff, data, 0, &taddr[idx],\n \t\t\t &ct->tuplehash[!dir].tuple.dst.u3,\n-\t\t\t htons(nated_port)) == 0) {\n-\t\t/* Save ports */\n-\t\tinfo->sig_port[dir] = port;\n-\t\tinfo->sig_port[!dir] = htons(nated_port);\n-\n-\t\t/* Fix for Gnomemeeting */\n-\t\tif (idx > 0 &&\n-\t\t get_h225_addr(ct, *data, &taddr[0], &addr, &port) &&\n-\t\t (ntohl(addr.ip) & 0xff000000) == 0x7f000000) {\n-\t\t\tset_h225_addr(skb, protoff, data, 0, &taddr[0],\n-\t\t\t\t &ct->tuplehash[!dir].tuple.dst.u3,\n-\t\t\t\t info->sig_port[!dir]);\n-\t\t}\n-\t} else {\n+\t\t\t htons(nated_port))) {\n \t\tnf_ct_unexpect_related(exp);\n \t\treturn -1;\n \t}\n \n+\t/* Save ports */\n+\tinfo->sig_port[dir] = port;\n+\tinfo->sig_port[!dir] = htons(nated_port);\n+\n+\t/* Fix for Gnomemeeting */\n+\tif (idx > 0 &&\n+\t get_h225_addr(ct, *data, &taddr[0], &addr, &port) &&\n+\t (ntohl(addr.ip) & 0xff000000) == 0x7f000000) {\n+\t\tif (set_h225_addr(skb, protoff, data, 0, &taddr[0],\n+\t\t\t\t &ct->tuplehash[!dir].tuple.dst.u3,\n+\t\t\t\t info->sig_port[!dir])) {\n+\t\t\tnf_ct_unexpect_related(exp);\n+\t\t\treturn -1;\n+\t\t}\n+\t}\n+\n \t/* Success */\n \tpr_debug(\"nf_nat_ras: expect Q.931 %pI4:%hu->%pI4:%hu\\n\",\n \t\t &exp->tuple.src.u3.ip,\n@@ -550,9 +553,9 @@ static int nat_callforwarding(struct sk_buff *skb, struct nf_conn *ct,\n \t}\n \n \t/* Modify signal */\n-\tif (!set_h225_addr(skb, protoff, data, dataoff, taddr,\n-\t\t\t &ct->tuplehash[!dir].tuple.dst.u3,\n-\t\t\t htons(nated_port)) == 0) {\n+\tif (set_h225_addr(skb, protoff, data, dataoff, taddr,\n+\t\t\t &ct->tuplehash[!dir].tuple.dst.u3,\n+\t\t\t htons(nated_port))) {\n \t\tnf_ct_unexpect_related(exp);\n \t\treturn -1;\n \t}\n", "prefixes": [ "31/47" ] }