Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/1641657/?format=api
{ "id": 1641657, "url": "http://patchwork.ozlabs.org/api/patches/1641657/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-ide/patch/20220610081801.11854-9-Sergey.Semin@baikalelectronics.ru/", "project": { "id": 13, "url": "http://patchwork.ozlabs.org/api/projects/13/?format=api", "name": "Linux IDE development", "link_name": "linux-ide", "list_id": "linux-ide.vger.kernel.org", "list_email": "linux-ide@vger.kernel.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20220610081801.11854-9-Sergey.Semin@baikalelectronics.ru>", "list_archive_url": null, "date": "2022-06-10T08:17:46", "name": "[v4,08/23] ata: libahci_platform: Sanity check the DT child nodes number", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "c66d03e646ffcc6d67744c1f6496363c3393cce3", "submitter": { "id": 78624, "url": "http://patchwork.ozlabs.org/api/people/78624/?format=api", "name": "Serge Semin", "email": "Sergey.Semin@baikalelectronics.ru" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linux-ide/patch/20220610081801.11854-9-Sergey.Semin@baikalelectronics.ru/mbox/", "series": [ { "id": 304159, "url": "http://patchwork.ozlabs.org/api/series/304159/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-ide/list/?series=304159", "date": "2022-06-10T08:17:42", "name": "ata: ahci: Add DWC/Baikal-T1 AHCI SATA support", "version": 4, "mbox": "http://patchwork.ozlabs.org/series/304159/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/1641657/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/1641657/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<linux-ide-owner@vger.kernel.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org", "Authentication-Results": [ "bilbo.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=baikalelectronics.ru header.i=@baikalelectronics.ru\n header.a=rsa-sha256 header.s=mail header.b=AXhY9zFT;\n\tdkim-atps=neutral", "ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2620:137:e000::1:20; helo=out1.vger.email;\n envelope-from=linux-ide-owner@vger.kernel.org; receiver=<UNKNOWN>)" ], "Received": [ "from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20])\n\tby bilbo.ozlabs.org (Postfix) with ESMTP id 4LKDPf36jVz9s5V\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 10 Jun 2022 18:18:46 +1000 (AEST)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n id S1347311AbiFJISn (ORCPT <rfc822;incoming@patchwork.ozlabs.org>);\n Fri, 10 Jun 2022 04:18:43 -0400", "from lindbergh.monkeyblade.net ([23.128.96.19]:35018 \"EHLO\n lindbergh.monkeyblade.net\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n with ESMTP id S1347323AbiFJISU (ORCPT\n <rfc822;linux-ide@vger.kernel.org>); Fri, 10 Jun 2022 04:18:20 -0400", "from mail.baikalelectronics.com (mail.baikalelectronics.com\n [87.245.175.230])\n by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0E183237943;\n Fri, 10 Jun 2022 01:18:17 -0700 (PDT)", "from mail (mail.baikal.int [192.168.51.25])\n by mail.baikalelectronics.com (Postfix) with ESMTP id B107E16A9;\n Fri, 10 Jun 2022 11:19:01 +0300 (MSK)", "from localhost (192.168.53.207) by mail (192.168.51.25) with\n Microsoft SMTP Server (TLS) id 15.0.1395.4; Fri, 10 Jun 2022 11:18:09 +0300" ], "DKIM-Filter": "OpenDKIM Filter v2.11.0 mail.baikalelectronics.com B107E16A9", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=baikalelectronics.ru; s=mail; t=1654849141;\n bh=PZFSfsCT24HFXj3Ecc6Vn3a7tOVoW/wc6B5ZrH2r9og=;\n h=From:To:CC:Subject:Date:In-Reply-To:References:From;\n b=AXhY9zFTvv4QQ7iOL8URRmLIIM/pOy7Hy827CSLgvOR1CjDCP+C6c+7daoF9YoA1q\n 2ui/tyTewWgnu27O0hNG3yj9obKCSnCeWEs7t5ywvlxKPmNEF5xDrtC14qOfcnsGxy\n Omone8uQoTehfJfcLYqq8WFgFVhcPkAq/8/R2NQ8=", "From": "Serge Semin <Sergey.Semin@baikalelectronics.ru>", "To": "Damien Le Moal <damien.lemoal@opensource.wdc.com>,\n Hans de Goede <hdegoede@redhat.com>,\n Jens Axboe <axboe@kernel.dk>, Hannes Reinecke <hare@suse.de>", "CC": "Serge Semin <Sergey.Semin@baikalelectronics.ru>,\n Serge Semin <fancer.lancer@gmail.com>,\n Alexey Malahov <Alexey.Malahov@baikalelectronics.ru>,\n Pavel Parkhomenko <Pavel.Parkhomenko@baikalelectronics.ru>,\n Rob Herring <robh+dt@kernel.org>, <linux-ide@vger.kernel.org>,\n <linux-kernel@vger.kernel.org>, <devicetree@vger.kernel.org>", "Subject": "[PATCH v4 08/23] ata: libahci_platform: Sanity check the DT child\n nodes number", "Date": "Fri, 10 Jun 2022 11:17:46 +0300", "Message-ID": "<20220610081801.11854-9-Sergey.Semin@baikalelectronics.ru>", "In-Reply-To": "<20220610081801.11854-1-Sergey.Semin@baikalelectronics.ru>", "References": "<20220610081801.11854-1-Sergey.Semin@baikalelectronics.ru>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Content-Type": "text/plain", "X-ClientProxiedBy": "MAIL.baikal.int (192.168.51.25) To mail (192.168.51.25)", "X-Spam-Status": "No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,\n DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS,\n T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no\n version=3.4.6", "X-Spam-Checker-Version": "SpamAssassin 3.4.6 (2021-04-09) on\n lindbergh.monkeyblade.net", "Precedence": "bulk", "List-ID": "<linux-ide.vger.kernel.org>", "X-Mailing-List": "linux-ide@vger.kernel.org" }, "content": "Having greater than AHCI_MAX_PORTS (32) ports detected isn't that critical\nfrom the further AHCI-platform initialization point of view since\nexceeding the ports upper limit will cause allocating more resources than\nwill be used afterwards. But detecting too many child DT-nodes doesn't\nseem right since it's very unlikely to have it on an ordinary platform. In\naccordance with the AHCI specification there can't be more than 32 ports\nimplemented at least due to having the CAP.NP field of 5 bits wide and the\nPI register of dword size. Thus if such situation is found the DTB must\nhave been corrupted and the data read from it shouldn't be reliable. Let's\nconsider that as an erroneous situation and halt further resources\nallocation.\n\nNote it's logically more correct to have the nports set only after the\ninitialization value is checked for being sane. So while at it let's make\nsure nports is assigned with a correct value.\n\nSigned-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru>\nReviewed-by: Hannes Reinecke <hare@suse.de>\n\n---\n\nChangelog v2:\n- Drop the else word from the child_nodes value checking if-else-if\n statement (@Damien) and convert the after-else part into the ternary\n operator-based statement.\n\nChangelog v4:\n- Fix some logical mistakes in the patch log. (@Sergei Shtylyov)\n---\n drivers/ata/libahci_platform.c | 13 ++++++++++---\n 1 file changed, 10 insertions(+), 3 deletions(-)", "diff": "diff --git a/drivers/ata/libahci_platform.c b/drivers/ata/libahci_platform.c\nindex 814804582d1d..8aed7b29c7ab 100644\n--- a/drivers/ata/libahci_platform.c\n+++ b/drivers/ata/libahci_platform.c\n@@ -451,15 +451,22 @@ struct ahci_host_priv *ahci_platform_get_resources(struct platform_device *pdev,\n \t\t}\n \t}\n \n-\thpriv->nports = child_nodes = of_get_child_count(dev->of_node);\n+\t/*\n+\t * Too many sub-nodes most likely means having something wrong with\n+\t * the firmware.\n+\t */\n+\tchild_nodes = of_get_child_count(dev->of_node);\n+\tif (child_nodes > AHCI_MAX_PORTS) {\n+\t\trc = -EINVAL;\n+\t\tgoto err_out;\n+\t}\n \n \t/*\n \t * If no sub-node was found, we still need to set nports to\n \t * one in order to be able to use the\n \t * ahci_platform_[en|dis]able_[phys|regulators] functions.\n \t */\n-\tif (!child_nodes)\n-\t\thpriv->nports = 1;\n+\thpriv->nports = child_nodes ?: 1;\n \n \thpriv->phys = devm_kcalloc(dev, hpriv->nports, sizeof(*hpriv->phys), GFP_KERNEL);\n \tif (!hpriv->phys) {\n", "prefixes": [ "v4", "08/23" ] }