* [PATCH][pci-next] PCI: endpoint: fix incorrect end of table check in while loop
@ 2017-08-23 16:03 ` Colin King
0 siblings, 0 replies; 8+ messages in thread
From: Colin King @ 2017-08-23 16:03 UTC (permalink / raw)
To: Kishon Vijay Abraham I, Bjorn Helgaas, linux-pci
Cc: kernel-janitors, linux-kernel
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>
---
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
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH][pci-next] PCI: endpoint: fix incorrect end of table check in while loop
@ 2017-08-23 16:03 ` Colin King
0 siblings, 0 replies; 8+ messages in thread
From: Colin King @ 2017-08-23 16:03 UTC (permalink / raw)
To: Kishon Vijay Abraham I, Bjorn Helgaas, linux-pci
Cc: kernel-janitors, linux-kernel
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>
---
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
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH][pci-next] PCI: endpoint: fix incorrect end of table check in while loop
2017-08-23 16:03 ` Colin King
@ 2017-08-28 18:25 ` Bjorn Helgaas
-1 siblings, 0 replies; 8+ messages in thread
From: Bjorn Helgaas @ 2017-08-28 18:25 UTC (permalink / raw)
To: Colin King
Cc: Kishon Vijay Abraham I, Bjorn Helgaas, linux-pci,
kernel-janitors, linux-kernel
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
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH][pci-next] PCI: endpoint: fix incorrect end of table check in while loop
@ 2017-08-28 18:25 ` Bjorn Helgaas
0 siblings, 0 replies; 8+ messages in thread
From: Bjorn Helgaas @ 2017-08-28 18:25 UTC (permalink / raw)
To: Colin King
Cc: Kishon Vijay Abraham I, Bjorn Helgaas, linux-pci,
kernel-janitors, linux-kernel
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
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH][pci-next] PCI: endpoint: fix incorrect end of table check in while loop
2017-08-28 18:25 ` Bjorn Helgaas
@ 2017-08-29 6:41 ` Kishon Vijay Abraham I
-1 siblings, 0 replies; 8+ messages in thread
From: Kishon Vijay Abraham I @ 2017-08-29 6:29 UTC (permalink / raw)
To: Bjorn Helgaas, Colin King
Cc: Bjorn Helgaas, linux-pci, kernel-janitors, linux-kernel
On Monday 28 August 2017 11:55 PM, Bjorn Helgaas wrote:
> 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?
Acked-by: Kishon Vijay Abraham I <kishon@ti.com>
>
>> ---
>> 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
>>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH][pci-next] PCI: endpoint: fix incorrect end of table check in while loop
@ 2017-08-29 6:41 ` Kishon Vijay Abraham I
0 siblings, 0 replies; 8+ messages in thread
From: Kishon Vijay Abraham I @ 2017-08-29 6:41 UTC (permalink / raw)
To: Bjorn Helgaas, Colin King
Cc: Bjorn Helgaas, linux-pci, kernel-janitors, linux-kernel
On Monday 28 August 2017 11:55 PM, Bjorn Helgaas wrote:
> 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?
Acked-by: Kishon Vijay Abraham I <kishon@ti.com>
>
>> ---
>> 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
>>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH][pci-next] PCI: endpoint: fix incorrect end of table check in while loop
2017-08-23 16:03 ` Colin King
@ 2017-08-29 21:00 ` Bjorn Helgaas
-1 siblings, 0 replies; 8+ messages in thread
From: Bjorn Helgaas @ 2017-08-29 21:00 UTC (permalink / raw)
To: Colin King
Cc: Kishon Vijay Abraham I, Bjorn Helgaas, linux-pci,
kernel-janitors, linux-kernel
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>
Folded into the original patch, thanks!
> ---
> 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
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH][pci-next] PCI: endpoint: fix incorrect end of table check in while loop
@ 2017-08-29 21:00 ` Bjorn Helgaas
0 siblings, 0 replies; 8+ messages in thread
From: Bjorn Helgaas @ 2017-08-29 21:00 UTC (permalink / raw)
To: Colin King
Cc: Kishon Vijay Abraham I, Bjorn Helgaas, linux-pci,
kernel-janitors, linux-kernel
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>
Folded into the original patch, thanks!
> ---
> 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
>
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2017-08-29 21:01 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-23 16:03 [PATCH][pci-next] PCI: endpoint: fix incorrect end of table check in while loop Colin King
2017-08-23 16:03 ` Colin King
2017-08-28 18:25 ` Bjorn Helgaas
2017-08-28 18:25 ` Bjorn Helgaas
2017-08-29 6:29 ` Kishon Vijay Abraham I
2017-08-29 6:41 ` Kishon Vijay Abraham I
2017-08-29 21:00 ` Bjorn Helgaas
2017-08-29 21:00 ` Bjorn Helgaas
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.