Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/807148/?format=api
{ "id": 807148, "url": "http://patchwork.ozlabs.org/api/patches/807148/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/patch/20170829150945.7077-1-phil@nwl.cc/", "project": { "id": 7, "url": "http://patchwork.ozlabs.org/api/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": "<20170829150945.7077-1-phil@nwl.cc>", "list_archive_url": null, "date": "2017-08-29T15:09:45", "name": "[iproute] lib/bpf: Fix bytecode-file parsing", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "a04cec1a44b1a397d517d465fe6d1fdf9cf7681f", "submitter": { "id": 4285, "url": "http://patchwork.ozlabs.org/api/people/4285/?format=api", "name": "Phil Sutter", "email": "phil@nwl.cc" }, "delegate": { "id": 389, "url": "http://patchwork.ozlabs.org/api/users/389/?format=api", "username": "shemminger", "first_name": "stephen", "last_name": "hemminger", "email": "shemminger@vyatta.com" }, "mbox": "http://patchwork.ozlabs.org/project/netdev/patch/20170829150945.7077-1-phil@nwl.cc/mbox/", "series": [ { "id": 391, "url": "http://patchwork.ozlabs.org/api/series/391/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/list/?series=391", "date": "2017-08-29T15:09:45", "name": "[iproute] lib/bpf: Fix bytecode-file parsing", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/391/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/807148/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/807148/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 3xhXB13LMrz9t2Q\n\tfor <patchwork-incoming@ozlabs.org>;\n\tWed, 30 Aug 2017 01:10:01 +1000 (AEST)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1752814AbdH2PJ7 (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tTue, 29 Aug 2017 11:09:59 -0400", "from orbyte.nwl.cc ([151.80.46.58]:55699 \"EHLO mail.nwl.cc\"\n\trhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP\n\tid S1752435AbdH2PJ6 (ORCPT <rfc822;netdev@vger.kernel.org>);\n\tTue, 29 Aug 2017 11:09:58 -0400", "from mail.nwl.cc (orbyte.nwl.cc [127.0.0.1])\n\tby mail.nwl.cc (Postfix) with ESMTP id A89E765A5E;\n\tTue, 29 Aug 2017 17:09:56 +0200 (CEST)", "from xsao (localhost [IPv6:::1])\n\tby mail.nwl.cc (Postfix) with ESMTP id 88BC76385C;\n\tTue, 29 Aug 2017 17:09:56 +0200 (CEST)" ], "From": "Phil Sutter <phil@nwl.cc>", "To": "Stephen Hemminger <stephen@networkplumber.org>", "Cc": "netdev@vger.kernel.org, Daniel Borkmann <daniel@iogearbox.net>", "Subject": "[iproute PATCH] lib/bpf: Fix bytecode-file parsing", "Date": "Tue, 29 Aug 2017 17:09:45 +0200", "Message-Id": "<20170829150945.7077-1-phil@nwl.cc>", "X-Mailer": "git-send-email 2.13.1", "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": "The signedness of char type is implementation dependent, and there are\narchitectures on which it is unsigned by default. In that case, the\ncheck whether fgetc() returned EOF failed because the return value was\nassigned an (unsigned) char variable prior to comparison with EOF (which\nis defined to -1). Fix this by using int as type for 'c' variable, which\nalso matches the declaration of fgetc().\n\nWhile being at it, fix the parser logic to correctly handle multiple\nempty lines and consecutive whitespace and tab characters to further\nimprove the parser's robustness. Note that this will still detect double\nseparator characters, so doesn't soften up the parser too much.\n\nFixes: 3da3ebfca85b8 (\"bpf: Make bytecode-file reading a little more robust\")\nCc: Daniel Borkmann <daniel@iogearbox.net>\nSigned-off-by: Phil Sutter <phil@nwl.cc>\n---\n lib/bpf.c | 7 +++++--\n 1 file changed, 5 insertions(+), 2 deletions(-)", "diff": "diff --git a/lib/bpf.c b/lib/bpf.c\nindex 0bd0a95eafe6c..77eb8ee27114f 100644\n--- a/lib/bpf.c\n+++ b/lib/bpf.c\n@@ -208,8 +208,9 @@ static int bpf_parse_string(char *arg, bool from_file, __u16 *bpf_len,\n \n \tif (from_file) {\n \t\tsize_t tmp_len, op_len = sizeof(\"65535 255 255 4294967295,\");\n-\t\tchar *tmp_string, *pos, c, c_prev = ' ';\n+\t\tchar *tmp_string, *pos, c_prev = ' ';\n \t\tFILE *fp;\n+\t\tint c;\n \n \t\ttmp_len = sizeof(\"4096,\") + BPF_MAXINSNS * op_len;\n \t\ttmp_string = pos = calloc(1, tmp_len);\n@@ -228,18 +229,20 @@ static int bpf_parse_string(char *arg, bool from_file, __u16 *bpf_len,\n \t\t\tcase '\\n':\n \t\t\t\tif (c_prev != ',')\n \t\t\t\t\t*(pos++) = ',';\n+\t\t\t\tc_prev = ',';\n \t\t\t\tbreak;\n \t\t\tcase ' ':\n \t\t\tcase '\\t':\n \t\t\t\tif (c_prev != ' ')\n \t\t\t\t\t*(pos++) = c;\n+\t\t\t\tc_prev = ' ';\n \t\t\t\tbreak;\n \t\t\tdefault:\n \t\t\t\t*(pos++) = c;\n+\t\t\t\tc_prev = c;\n \t\t\t}\n \t\t\tif (pos - tmp_string == tmp_len)\n \t\t\t\tbreak;\n-\t\t\tc_prev = c;\n \t\t}\n \n \t\tif (!feof(fp)) {\n", "prefixes": [ "iproute" ] }