* [dpdk-dev] [PATCH] examples/kni: unchecked return value
@ 2016-05-09 9:38 Daniel Mrzyglod
2016-05-09 8:49 ` Zhang, Helin
2016-05-16 12:32 ` Thomas Monjalon
0 siblings, 2 replies; 3+ messages in thread
From: Daniel Mrzyglod @ 2016-05-09 9:38 UTC (permalink / raw)
To: helin.zhang; +Cc: dev, Daniel Mrzyglod
Fix issue reported by Coverity.
Coverity ID 30692
If the function returns an error value, the error value may be mistaken for
a normal value.
In kni_free_kni: Value returned from a function is not checked for errors
before being used
Fixes: b475eb0bc400 ("examples/kni: new parameters")
Signed-off-by: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>
---
examples/kni/main.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/examples/kni/main.c b/examples/kni/main.c
index a5297f2..dcecd09 100644
--- a/examples/kni/main.c
+++ b/examples/kni/main.c
@@ -831,7 +831,8 @@ kni_free_kni(uint8_t port_id)
return -1;
for (i = 0; i < p[port_id]->nb_kni; i++) {
- rte_kni_release(p[port_id]->kni[i]);
+ if (rte_kni_release(p[port_id]->kni[i]))
+ printf("fail to release kni\n");
p[port_id]->kni[i] = NULL;
}
rte_eth_dev_stop(port_id);
--
2.5.5
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-dev] [PATCH] examples/kni: unchecked return value
2016-05-09 9:38 [dpdk-dev] [PATCH] examples/kni: unchecked return value Daniel Mrzyglod
@ 2016-05-09 8:49 ` Zhang, Helin
2016-05-16 12:32 ` Thomas Monjalon
1 sibling, 0 replies; 3+ messages in thread
From: Zhang, Helin @ 2016-05-09 8:49 UTC (permalink / raw)
To: Mrzyglod, DanielX T; +Cc: dev
> -----Original Message-----
> From: Mrzyglod, DanielX T
> Sent: Monday, May 9, 2016 5:39 PM
> To: Zhang, Helin <helin.zhang@intel.com>
> Cc: dev@dpdk.org; Mrzyglod, DanielX T <danielx.t.mrzyglod@intel.com>
> Subject: [PATCH] examples/kni: unchecked return value
>
> Fix issue reported by Coverity.
> Coverity ID 30692
>
> If the function returns an error value, the error value may be mistaken for a
> normal value.
>
> In kni_free_kni: Value returned from a function is not checked for errors before
> being used
>
> Fixes: b475eb0bc400 ("examples/kni: new parameters")
>
> Signed-off-by: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-dev] [PATCH] examples/kni: unchecked return value
2016-05-09 9:38 [dpdk-dev] [PATCH] examples/kni: unchecked return value Daniel Mrzyglod
2016-05-09 8:49 ` Zhang, Helin
@ 2016-05-16 12:32 ` Thomas Monjalon
1 sibling, 0 replies; 3+ messages in thread
From: Thomas Monjalon @ 2016-05-16 12:32 UTC (permalink / raw)
To: Daniel Mrzyglod; +Cc: dev, helin.zhang
2016-05-09 11:38, Daniel Mrzyglod:
> Fix issue reported by Coverity.
> Coverity ID 30692
Better to put reference on top of Fixes: line.
> If the function returns an error value, the error value may be mistaken for
> a normal value.
>
> In kni_free_kni: Value returned from a function is not checked for errors
> before being used
One of the 2 sentences is enough.
> Fixes: b475eb0bc400 ("examples/kni: new parameters")
>
> Signed-off-by: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>
> ---
> examples/kni/main.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/examples/kni/main.c b/examples/kni/main.c
> index a5297f2..dcecd09 100644
> --- a/examples/kni/main.c
> +++ b/examples/kni/main.c
> @@ -831,7 +831,8 @@ kni_free_kni(uint8_t port_id)
> return -1;
>
> for (i = 0; i < p[port_id]->nb_kni; i++) {
> - rte_kni_release(p[port_id]->kni[i]);
> + if (rte_kni_release(p[port_id]->kni[i]))
> + printf("fail to release kni\n");
Other error messages of this file start with an uppercase.
Applied with above changes, thanks
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-05-16 12:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-09 9:38 [dpdk-dev] [PATCH] examples/kni: unchecked return value Daniel Mrzyglod
2016-05-09 8:49 ` Zhang, Helin
2016-05-16 12:32 ` Thomas Monjalon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).