get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/875069/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 875069,
    "url": "http://patchwork.ozlabs.org/api/patches/875069/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20180219102330.22045-1-colin.king@canonical.com/",
    "project": {
        "id": 46,
        "url": "http://patchwork.ozlabs.org/api/projects/46/?format=api",
        "name": "Intel Wired Ethernet development",
        "link_name": "intel-wired-lan",
        "list_id": "intel-wired-lan.osuosl.org",
        "list_email": "intel-wired-lan@osuosl.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20180219102330.22045-1-colin.king@canonical.com>",
    "list_archive_url": null,
    "date": "2018-02-19T10:23:30",
    "name": "[V2] i40evf: remove redundant array comparisons to 0 checks",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "5068f4751a12c35dcfcaa52d2c89ea1c04f1302d",
    "submitter": {
        "id": 2900,
        "url": "http://patchwork.ozlabs.org/api/people/2900/?format=api",
        "name": "Colin Ian King",
        "email": "colin.king@canonical.com"
    },
    "delegate": {
        "id": 68,
        "url": "http://patchwork.ozlabs.org/api/users/68/?format=api",
        "username": "jtkirshe",
        "first_name": "Jeff",
        "last_name": "Kirsher",
        "email": "jeffrey.t.kirsher@intel.com"
    },
    "mbox": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20180219102330.22045-1-colin.king@canonical.com/mbox/",
    "series": [
        {
            "id": 29307,
            "url": "http://patchwork.ozlabs.org/api/series/29307/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=29307",
            "date": "2018-02-19T10:23:30",
            "name": "[V2] i40evf: remove redundant array comparisons to 0 checks",
            "version": 2,
            "mbox": "http://patchwork.ozlabs.org/series/29307/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/875069/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/875069/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<intel-wired-lan-bounces@osuosl.org>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "intel-wired-lan@lists.osuosl.org"
        ],
        "Delivered-To": [
            "patchwork-incoming@bilbo.ozlabs.org",
            "intel-wired-lan@lists.osuosl.org"
        ],
        "Authentication-Results": "ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=osuosl.org\n\t(client-ip=140.211.166.133; helo=hemlock.osuosl.org;\n\tenvelope-from=intel-wired-lan-bounces@osuosl.org;\n\treceiver=<UNKNOWN>)",
        "Received": [
            "from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3zlKbJ0XJ5z9s0w\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon, 19 Feb 2018 21:23:38 +1100 (AEDT)",
            "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 0CD2C8789B;\n\tMon, 19 Feb 2018 10:23:37 +0000 (UTC)",
            "from hemlock.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id OM8TPU4UgdHL; Mon, 19 Feb 2018 10:23:36 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 756F387782;\n\tMon, 19 Feb 2018 10:23:36 +0000 (UTC)",
            "from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n\tby ash.osuosl.org (Postfix) with ESMTP id 88D421C064C\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tMon, 19 Feb 2018 10:23:35 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 833D48777F\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tMon, 19 Feb 2018 10:23:35 +0000 (UTC)",
            "from hemlock.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id hS8U4o18k+C4 for <intel-wired-lan@lists.osuosl.org>;\n\tMon, 19 Feb 2018 10:23:34 +0000 (UTC)",
            "from youngberry.canonical.com (youngberry.canonical.com\n\t[91.189.89.112])\n\tby hemlock.osuosl.org (Postfix) with ESMTPS id B027587782\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tMon, 19 Feb 2018 10:23:34 +0000 (UTC)",
            "from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost)\n\tby youngberry.canonical.com with esmtpsa\n\t(TLS1.0:RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.76) (envelope-from <colin.king@canonical.com>)\n\tid 1enibb-0004U3-8m; Mon, 19 Feb 2018 10:23:31 +0000"
        ],
        "X-Virus-Scanned": [
            "amavisd-new at osuosl.org",
            "amavisd-new at osuosl.org"
        ],
        "X-Greylist": "domain auto-whitelisted by SQLgrey-1.7.6",
        "From": "Colin King <colin.king@canonical.com>",
        "To": "Jeff Kirsher <jeffrey.t.kirsher@intel.com>,\n\tintel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org",
        "Date": "Mon, 19 Feb 2018 10:23:30 +0000",
        "Message-Id": "<20180219102330.22045-1-colin.king@canonical.com>",
        "X-Mailer": "git-send-email 2.15.1",
        "MIME-Version": "1.0",
        "Subject": "[Intel-wired-lan] [PATCH][V2] i40evf: remove redundant array\n\tcomparisons to 0 checks",
        "X-BeenThere": "intel-wired-lan@osuosl.org",
        "X-Mailman-Version": "2.1.24",
        "Precedence": "list",
        "List-Id": "Intel Wired Ethernet Linux Kernel Driver Development\n\t<intel-wired-lan.osuosl.org>",
        "List-Unsubscribe": "<https://lists.osuosl.org/mailman/options/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@osuosl.org?subject=unsubscribe>",
        "List-Archive": "<http://lists.osuosl.org/pipermail/intel-wired-lan/>",
        "List-Post": "<mailto:intel-wired-lan@osuosl.org>",
        "List-Help": "<mailto:intel-wired-lan-request@osuosl.org?subject=help>",
        "List-Subscribe": "<https://lists.osuosl.org/mailman/listinfo/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@osuosl.org?subject=subscribe>",
        "Cc": "kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Errors-To": "intel-wired-lan-bounces@osuosl.org",
        "Sender": "\"Intel-wired-lan\" <intel-wired-lan-bounces@osuosl.org>"
    },
    "content": "From: Colin Ian King <colin.king@canonical.com>\n\nThe checks to see if key->dst.s6_addr and key->src.s6_addr are null\npointers are redundant because these are constant size arrays and\nso the checks always return true.  Fix this by removing the redundant\nchecks.   Also replace filter->f with vf, allowing wide lines to be\ncondensed and to rejoin some split wide lines.\n\nDetected by CoverityScan, CID#1465279 (\"Array compared to 0\")\n\nSigned-off-by: Colin Ian King <colin.king@canonical.com>\n---\n drivers/net/ethernet/intel/i40evf/i40evf_main.c | 61 ++++++++++---------------\n 1 file changed, 25 insertions(+), 36 deletions(-)",
    "diff": "diff --git a/drivers/net/ethernet/intel/i40evf/i40evf_main.c b/drivers/net/ethernet/intel/i40evf/i40evf_main.c\nindex 4955ce3ab6a2..a13df27089c3 100644\n--- a/drivers/net/ethernet/intel/i40evf/i40evf_main.c\n+++ b/drivers/net/ethernet/intel/i40evf/i40evf_main.c\n@@ -2493,6 +2493,7 @@ static int i40evf_parse_cls_flower(struct i40evf_adapter *adapter,\n \tu16 addr_type = 0;\n \tu16 n_proto = 0;\n \tint i = 0;\n+\tstruct virtchnl_filter *vf = &filter->f;\n \n \tif (f->dissector->used_keys &\n \t    ~(BIT(FLOW_DISSECTOR_KEY_CONTROL) |\n@@ -2540,7 +2541,7 @@ static int i40evf_parse_cls_flower(struct i40evf_adapter *adapter,\n \t\t\treturn -EINVAL;\n \t\tif (n_proto == ETH_P_IPV6) {\n \t\t\t/* specify flow type as TCP IPv6 */\n-\t\t\tfilter->f.flow_type = VIRTCHNL_TCP_V6_FLOW;\n+\t\t\tvf->flow_type = VIRTCHNL_TCP_V6_FLOW;\n \t\t}\n \n \t\tif (key->ip_proto != IPPROTO_TCP) {\n@@ -2585,9 +2586,8 @@ static int i40evf_parse_cls_flower(struct i40evf_adapter *adapter,\n \t\t\t    is_multicast_ether_addr(key->dst)) {\n \t\t\t\t/* set the mask if a valid dst_mac address */\n \t\t\t\tfor (i = 0; i < ETH_ALEN; i++)\n-\t\t\t\t\tfilter->f.mask.tcp_spec.dst_mac[i] |=\n-\t\t\t\t\t\t\t\t\t0xff;\n-\t\t\t\tether_addr_copy(filter->f.data.tcp_spec.dst_mac,\n+\t\t\t\t\tvf->mask.tcp_spec.dst_mac[i] |= 0xff;\n+\t\t\t\tether_addr_copy(vf->data.tcp_spec.dst_mac,\n \t\t\t\t\t\tkey->dst);\n \t\t\t}\n \n@@ -2596,9 +2596,8 @@ static int i40evf_parse_cls_flower(struct i40evf_adapter *adapter,\n \t\t\t    is_multicast_ether_addr(key->src)) {\n \t\t\t\t/* set the mask if a valid dst_mac address */\n \t\t\t\tfor (i = 0; i < ETH_ALEN; i++)\n-\t\t\t\t\tfilter->f.mask.tcp_spec.src_mac[i] |=\n-\t\t\t\t\t\t\t\t\t0xff;\n-\t\t\t\tether_addr_copy(filter->f.data.tcp_spec.src_mac,\n+\t\t\t\t\tvf->mask.tcp_spec.src_mac[i] |= 0xff;\n+\t\t\t\tether_addr_copy(vf->data.tcp_spec.src_mac,\n \t\t\t\t\t\tkey->src);\n \t\t}\n \t}\n@@ -2622,8 +2621,8 @@ static int i40evf_parse_cls_flower(struct i40evf_adapter *adapter,\n \t\t\t\treturn I40E_ERR_CONFIG;\n \t\t\t}\n \t\t}\n-\t\tfilter->f.mask.tcp_spec.vlan_id |= cpu_to_be16(0xffff);\n-\t\tfilter->f.data.tcp_spec.vlan_id = cpu_to_be16(key->vlan_id);\n+\t\tvf->mask.tcp_spec.vlan_id |= cpu_to_be16(0xffff);\n+\t\tvf->data.tcp_spec.vlan_id = cpu_to_be16(key->vlan_id);\n \t}\n \n \tif (dissector_uses_key(f->dissector, FLOW_DISSECTOR_KEY_CONTROL)) {\n@@ -2670,14 +2669,12 @@ static int i40evf_parse_cls_flower(struct i40evf_adapter *adapter,\n \t\t\treturn I40E_ERR_CONFIG;\n \t\t}\n \t\tif (key->dst) {\n-\t\t\tfilter->f.mask.tcp_spec.dst_ip[0] |=\n-\t\t\t\t\t\t\tcpu_to_be32(0xffffffff);\n-\t\t\tfilter->f.data.tcp_spec.dst_ip[0] = key->dst;\n+\t\t\tvf->mask.tcp_spec.dst_ip[0] |= cpu_to_be32(0xffffffff);\n+\t\t\tvf->data.tcp_spec.dst_ip[0] = key->dst;\n \t\t}\n \t\tif (key->src) {\n-\t\t\tfilter->f.mask.tcp_spec.src_ip[0] |=\n-\t\t\t\t\t\t\tcpu_to_be32(0xffffffff);\n-\t\t\tfilter->f.data.tcp_spec.src_ip[0] = key->src;\n+\t\t\tvf->mask.tcp_spec.src_ip[0] |= cpu_to_be32(0xffffffff);\n+\t\t\tvf->data.tcp_spec.src_ip[0] = key->src;\n \t\t}\n \t}\n \n@@ -2710,22 +2707,14 @@ static int i40evf_parse_cls_flower(struct i40evf_adapter *adapter,\n \t\tif (!ipv6_addr_any(&mask->dst) || !ipv6_addr_any(&mask->src))\n \t\t\tfield_flags |= I40EVF_CLOUD_FIELD_IIP;\n \n-\t\tif (key->dst.s6_addr) {\n-\t\t\tfor (i = 0; i < 4; i++)\n-\t\t\t\tfilter->f.mask.tcp_spec.dst_ip[i] |=\n-\t\t\t\t\t\t\tcpu_to_be32(0xffffffff);\n-\t\t\tmemcpy(&filter->f.data.tcp_spec.dst_ip,\n-\t\t\t       &key->dst.s6_addr32,\n-\t\t\t       sizeof(filter->f.data.tcp_spec.dst_ip));\n-\t\t}\n-\t\tif (key->src.s6_addr) {\n-\t\t\tfor (i = 0; i < 4; i++)\n-\t\t\t\tfilter->f.mask.tcp_spec.src_ip[i] |=\n-\t\t\t\t\t\t\tcpu_to_be32(0xffffffff);\n-\t\t\tmemcpy(&filter->f.data.tcp_spec.src_ip,\n-\t\t\t       &key->src.s6_addr32,\n-\t\t\t       sizeof(filter->f.data.tcp_spec.src_ip));\n-\t\t}\n+\t\tfor (i = 0; i < 4; i++)\n+\t\t\tvf->mask.tcp_spec.dst_ip[i] |= cpu_to_be32(0xffffffff);\n+\t\tmemcpy(&vf->data.tcp_spec.dst_ip, &key->dst.s6_addr32,\n+\t\t       sizeof(vf->data.tcp_spec.dst_ip));\n+\t\tfor (i = 0; i < 4; i++)\n+\t\t\tvf->mask.tcp_spec.src_ip[i] |= cpu_to_be32(0xffffffff);\n+\t\tmemcpy(&vf->data.tcp_spec.src_ip, &key->src.s6_addr32,\n+\t\t       sizeof(vf->data.tcp_spec.src_ip));\n \t}\n \tif (dissector_uses_key(f->dissector, FLOW_DISSECTOR_KEY_PORTS)) {\n \t\tstruct flow_dissector_key_ports *key =\n@@ -2757,16 +2746,16 @@ static int i40evf_parse_cls_flower(struct i40evf_adapter *adapter,\n \t\t\t}\n \t\t}\n \t\tif (key->dst) {\n-\t\t\tfilter->f.mask.tcp_spec.dst_port |= cpu_to_be16(0xffff);\n-\t\t\tfilter->f.data.tcp_spec.dst_port = key->dst;\n+\t\t\tvf->mask.tcp_spec.dst_port |= cpu_to_be16(0xffff);\n+\t\t\tvf->data.tcp_spec.dst_port = key->dst;\n \t\t}\n \n \t\tif (key->src) {\n-\t\t\tfilter->f.mask.tcp_spec.src_port |= cpu_to_be16(0xffff);\n-\t\t\tfilter->f.data.tcp_spec.src_port = key->dst;\n+\t\t\tvf->mask.tcp_spec.src_port |= cpu_to_be16(0xffff);\n+\t\t\tvf->data.tcp_spec.src_port = key->dst;\n \t\t}\n \t}\n-\tfilter->f.field_flags = field_flags;\n+\tvf->field_flags = field_flags;\n \n \treturn 0;\n }\n",
    "prefixes": [
        "V2"
    ]
}