{"id":805088,"url":"http://patchwork.ozlabs.org/api/1.2/patches/805088/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-pci/patch/20170823160303.23366-1-colin.king@canonical.com/","project":{"id":28,"url":"http://patchwork.ozlabs.org/api/1.2/projects/28/?format=json","name":"Linux PCI development","link_name":"linux-pci","list_id":"linux-pci.vger.kernel.org","list_email":"linux-pci@vger.kernel.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20170823160303.23366-1-colin.king@canonical.com>","list_archive_url":null,"date":"2017-08-23T16:03:03","name":"[pci-next] PCI: endpoint: fix incorrect end of table check in while loop","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"ae1491d78a39811bd39eadfe15a7cf899af15bb7","submitter":{"id":2900,"url":"http://patchwork.ozlabs.org/api/1.2/people/2900/?format=json","name":"Colin Ian King","email":"colin.king@canonical.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linux-pci/patch/20170823160303.23366-1-colin.king@canonical.com/mbox/","series":[],"comments":"http://patchwork.ozlabs.org/api/patches/805088/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/805088/checks/","tags":{},"related":[],"headers":{"Return-Path":"<linux-pci-owner@vger.kernel.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.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=linux-pci-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 3xcsf402zXz9s7M\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 24 Aug 2017 02:03:08 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S932120AbdHWQDF (ORCPT <rfc822;incoming@patchwork.ozlabs.org>);\n\tWed, 23 Aug 2017 12:03:05 -0400","from youngberry.canonical.com ([91.189.89.112]:53523 \"EHLO\n\tyoungberry.canonical.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S932118AbdHWQDF (ORCPT\n\t<rfc822; linux-pci@vger.kernel.org>); Wed, 23 Aug 2017 12:03:05 -0400","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) (Exim 4.76)\n\t(envelope-from <colin.king@canonical.com>)\n\tid 1dkY7T-0002IP-Gw; Wed, 23 Aug 2017 16:03:03 +0000"],"From":"Colin King <colin.king@canonical.com>","To":"Kishon Vijay Abraham I <kishon@ti.com>,\n\tBjorn Helgaas <bhelgaas@google.com>, linux-pci@vger.kernel.org","Cc":"kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org","Subject":"[PATCH][pci-next] PCI: endpoint: fix incorrect end of table check\n\tin while loop","Date":"Wed, 23 Aug 2017 17:03:03 +0100","Message-Id":"<20170823160303.23366-1-colin.king@canonical.com>","X-Mailer":"git-send-email 2.14.1","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"8bit","Sender":"linux-pci-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<linux-pci.vger.kernel.org>","X-Mailing-List":"linux-pci@vger.kernel.org"},"content":"From: Colin Ian King <colin.king@canonical.com>\n\nCurrently, the while loop will iterate until a matching name is found\nor until the id pointer wraps around to NULL (the latter is incorrect).\n\nThe end of a pci_epf_device_id table is terminated with zero'd entries\nfor name and driver_data, so can change the while loop to iterate while\nthe first character in the name is a non-zero character.\n\nDetected by CoverityScan, CID#1454557 (\"Logically dead code\")\n\nFixes: 9e9d6eb48623 (\"PCI: endpoint: Add an API to get matching \"pci_epf_device_id\")\nSigned-off-by: Colin Ian King <colin.king@canonical.com>\n---\n drivers/pci/endpoint/pci-epf-core.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)","diff":"diff --git a/drivers/pci/endpoint/pci-epf-core.c b/drivers/pci/endpoint/pci-epf-core.c\nindex ae6fac5995e3..70eccc04ee7f 100644\n--- a/drivers/pci/endpoint/pci-epf-core.c\n+++ b/drivers/pci/endpoint/pci-epf-core.c\n@@ -273,7 +273,7 @@ pci_epf_match_device(const struct pci_epf_device_id *id, struct pci_epf *epf)\n \tif (!id || !epf)\n \t\treturn NULL;\n \n-\twhile (id) {\n+\twhile (*id->name) {\n \t\tif (strcmp(epf->name, id->name) == 0)\n \t\t\treturn id;\n \t\tid++;\n","prefixes":["pci-next"]}