Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/595228/?format=api
{ "id": 595228, "url": "http://patchwork.ozlabs.org/api/patches/595228/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20160309202557.137597.51678.stgit@bwallan-cwp1.jf.intel.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": "<20160309202557.137597.51678.stgit@bwallan-cwp1.jf.intel.com>", "list_archive_url": null, "date": "2016-03-09T20:26:18", "name": "[next-queue,v3] fm10k: Avoid crashing the kernel", "commit_ref": null, "pull_url": null, "state": "changes-requested", "archived": false, "hash": "8d9ce8b536c3ed2e89cce945d9826b8329bee8aa", "submitter": { "id": 503, "url": "http://patchwork.ozlabs.org/api/people/503/?format=api", "name": "Allan, Bruce W", "email": "bruce.w.allan@intel.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/20160309202557.137597.51678.stgit@bwallan-cwp1.jf.intel.com/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/595228/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/595228/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<intel-wired-lan-bounces@lists.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" ], "Received": [ "from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n\tby ozlabs.org (Postfix) with ESMTP id 6EACF14032A\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 10 Mar 2016 07:26:24 +1100 (AEDT)", "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 6D92A8756A;\n\tWed, 9 Mar 2016 20:26:23 +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 2vYHppMthmVa; Wed, 9 Mar 2016 20:26:21 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 7A32A84F56;\n\tWed, 9 Mar 2016 20:26:21 +0000 (UTC)", "from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137])\n\tby ash.osuosl.org (Postfix) with ESMTP id B63581C0D9C\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 9 Mar 2016 20:26:19 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id B09108BE49\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 9 Mar 2016 20:26:19 +0000 (UTC)", "from fraxinus.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id nGLcqh3nUGn3 for <intel-wired-lan@lists.osuosl.org>;\n\tWed, 9 Mar 2016 20:26:19 +0000 (UTC)", "from mga09.intel.com (mga09.intel.com [134.134.136.24])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 14E4CA5B18\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 9 Mar 2016 20:26:19 +0000 (UTC)", "from orsmga002.jf.intel.com ([10.7.209.21])\n\tby orsmga102.jf.intel.com with ESMTP; 09 Mar 2016 12:26:18 -0800", "from bwallan-cwp1.jf.intel.com ([10.166.136.30])\n\tby orsmga002.jf.intel.com with ESMTP; 09 Mar 2016 12:26:18 -0800", "from bwallan-cwp1.jf.intel.com (localhost [127.0.0.1])\n\tby bwallan-cwp1.jf.intel.com (8.15.2/8.15.1) with ESMTP id\n\tu29KQIes137621\n\tfor <intel-wired-lan@lists.osuosl.org>; Wed, 9 Mar 2016 12:26:18 -0800" ], "X-Virus-Scanned": [ "amavisd-new at osuosl.org", "amavisd-new at osuosl.org" ], "X-Greylist": "domain auto-whitelisted by SQLgrey-1.7.6", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.24,312,1455004800\"; d=\"scan'208\";a=\"930403016\"", "From": "Bruce Allan <bruce.w.allan@intel.com>", "To": "intel-wired-lan@lists.osuosl.org", "Date": "Wed, 09 Mar 2016 12:26:18 -0800", "Message-ID": "<20160309202557.137597.51678.stgit@bwallan-cwp1.jf.intel.com>", "User-Agent": "StGit/0.17.1-dirty", "MIME-Version": "1.0", "Subject": "[Intel-wired-lan] [next-queue PATCH v3] fm10k: Avoid crashing the\n\tkernel", "X-BeenThere": "intel-wired-lan@lists.osuosl.org", "X-Mailman-Version": "2.1.18-1", "Precedence": "list", "List-Id": "Intel Wired Ethernet Linux Kernel Driver Development\n\t<intel-wired-lan.lists.osuosl.org>", "List-Unsubscribe": "<http://lists.osuosl.org/mailman/options/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@lists.osuosl.org?subject=unsubscribe>", "List-Archive": "<http://lists.osuosl.org/pipermail/intel-wired-lan/>", "List-Post": "<mailto:intel-wired-lan@lists.osuosl.org>", "List-Help": "<mailto:intel-wired-lan-request@lists.osuosl.org?subject=help>", "List-Subscribe": "<http://lists.osuosl.org/mailman/listinfo/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@lists.osuosl.org?subject=subscribe>", "Content-Type": "text/plain; charset=\"us-ascii\"", "Content-Transfer-Encoding": "7bit", "Errors-To": "intel-wired-lan-bounces@lists.osuosl.org", "Sender": "\"Intel-wired-lan\" <intel-wired-lan-bounces@lists.osuosl.org>" }, "content": "Use BUILD_BUG_ON() instead of BUG_ON() where appropriate to get a compile\nerror rather than crash the kernel.\n\nUnfortunately, BUILD_BUG_ON() cannot be used to replace the second instance\nof BUG_ON() as it will generate a compiletime assert when the compiler flag\n-fsanitize=signed-integer-overflow is used (e.g. when UBSAN is enabled).\nInstead, put in additional checks to prevent buffer overflow from occuring\nand WARN if the code is ever mistakenly changed to get additional register\nvalues without also updating the value of FM10K_REGS_LEN_VSI.\n\nAlso, replace associated magic numbers with existing defined constants and\ncorrect an applicable comment.\n\nSigned-off-by: Bruce Allan <bruce.w.allan@intel.com>\n---\nv3: changes described in 2nd and 3rd paragraphs in updated description\n drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c | 22 +++++++++++++---------\n 1 file changed, 13 insertions(+), 9 deletions(-)", "diff": "diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c b/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c\nindex c8ee3b5..6952ce2 100644\n--- a/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c\n+++ b/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c\n@@ -352,23 +352,27 @@ static void fm10k_get_reg_q(struct fm10k_hw *hw, u32 *buff, int i)\n \tbuff[idx++] = fm10k_read_reg(hw, FM10K_TX_SGLORT(i));\n \tbuff[idx++] = fm10k_read_reg(hw, FM10K_PFVTCTL(i));\n \n-\tBUG_ON(idx != FM10K_REGS_LEN_Q);\n+\tBUILD_BUG_ON(idx != FM10K_REGS_LEN_Q);\n }\n \n-/* If function above adds more registers this define needs to be updated */\n-#define FM10K_REGS_LEN_VSI 43\n+/* If function below adds more registers this define needs to be updated */\n+#define FM10K_REGS_LEN_VSI (1 + FM10K_RSSRK_SIZE + FM10K_RETA_SIZE)\n \n static void fm10k_get_reg_vsi(struct fm10k_hw *hw, u32 *buff, int i)\n {\n \tint idx = 0, j;\n \n \tbuff[idx++] = fm10k_read_reg(hw, FM10K_MRQC(i));\n-\tfor (j = 0; j < 10; j++)\n-\t\tbuff[idx++] = fm10k_read_reg(hw, FM10K_RSSRK(i, j));\n-\tfor (j = 0; j < 32; j++)\n-\t\tbuff[idx++] = fm10k_read_reg(hw, FM10K_RETA(i, j));\n-\n-\tBUG_ON(idx != FM10K_REGS_LEN_VSI);\n+\tfor (j = 0; j < FM10K_RSSRK_SIZE; j++, idx++)\n+\t\tif (idx < FM10K_REGS_LEN_VSI)\n+\t\t\tbuff[idx] = fm10k_read_reg(hw, FM10K_RSSRK(i, j));\n+\tfor (j = 0; j < FM10K_RETA_SIZE; j++, idx++)\n+\t\tif (idx < FM10K_REGS_LEN_VSI)\n+\t\t\tbuff[idx] = fm10k_read_reg(hw, FM10K_RETA(i, j));\n+\n+\tWARN_ONCE(idx != FM10K_REGS_LEN_VSI,\n+\t\t \"Incorrect value for FM10K_REGS_LEN_VSI (expected %d, got %d)\\n\",\n+\t\t idx, FM10K_REGS_LEN_VSI);\n }\n \n static void fm10k_get_regs(struct net_device *netdev,\n", "prefixes": [ "next-queue", "v3" ] }