From: Bjorn Helgaas <helgaas@kernel.org>
To: Colin King <colin.king@canonical.com>
Cc: Kishon Vijay Abraham I <kishon@ti.com>,
Bjorn Helgaas <bhelgaas@google.com>,
linux-pci@vger.kernel.org, kernel-janitors@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH][pci-next] PCI: endpoint: fix incorrect end of table check in while loop
Date: Mon, 28 Aug 2017 13:25:05 -0500 [thread overview]
Message-ID: <20170828182505.GH8154@bhelgaas-glaptop.roam.corp.google.com> (raw)
In-Reply-To: <20170823160303.23366-1-colin.king@canonical.com>
On Wed, Aug 23, 2017 at 05:03:03PM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Currently, the while loop will iterate until a matching name is found
> or until the id pointer wraps around to NULL (the latter is incorrect).
>
> The end of a pci_epf_device_id table is terminated with zero'd entries
> for name and driver_data, so can change the while loop to iterate while
> the first character in the name is a non-zero character.
>
> Detected by CoverityScan, CID#1454557 ("Logically dead code")
>
> Fixes: 9e9d6eb48623 ("PCI: endpoint: Add an API to get matching "pci_epf_device_id")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
Kishon, do you want to ack this, please?
> ---
> drivers/pci/endpoint/pci-epf-core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/pci/endpoint/pci-epf-core.c b/drivers/pci/endpoint/pci-epf-core.c
> index ae6fac5995e3..70eccc04ee7f 100644
> --- a/drivers/pci/endpoint/pci-epf-core.c
> +++ b/drivers/pci/endpoint/pci-epf-core.c
> @@ -273,7 +273,7 @@ pci_epf_match_device(const struct pci_epf_device_id *id, struct pci_epf *epf)
> if (!id || !epf)
> return NULL;
>
> - while (id) {
> + while (*id->name) {
> if (strcmp(epf->name, id->name) == 0)
> return id;
> id++;
> --
> 2.14.1
>
next prev parent reply other threads:[~2017-08-28 18:25 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-23 16:03 Colin King
2017-08-28 18:25 ` Bjorn Helgaas [this message]
2017-08-29 6:29 ` Kishon Vijay Abraham I
2017-08-29 21:00 ` Bjorn Helgaas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170828182505.GH8154@bhelgaas-glaptop.roam.corp.google.com \
--to=helgaas@kernel.org \
--cc=bhelgaas@google.com \
--cc=colin.king@canonical.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=kishon@ti.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®