diff mbox series

common/dpaax: fix incorrect error case

Message ID 20181024054334.23732-1-shreyansh.jain@nxp.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers show
Series common/dpaax: fix incorrect error case | expand

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Shreyansh Jain Oct. 24, 2018, 5:44 a.m. UTC
In case the memory for nodes cannot be allocated, there is no need
to check for the length. Also, `node_count` is an unsigned value
and cannot be less than 0.

Coverity issue: 323521

Fixes: 2f3d633aa593 ("common/dpaax: add library for PA/VA translation table")
Cc: shreyansh.jain@nxp.com

Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
 drivers/common/dpaax/dpaax_iova_table.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Thomas Monjalon Oct. 24, 2018, 10:42 p.m. UTC | #1
24/10/2018 07:44, Shreyansh Jain:
> In case the memory for nodes cannot be allocated, there is no need
> to check for the length. Also, `node_count` is an unsigned value
> and cannot be less than 0.
> 
> Coverity issue: 323521
> 
> Fixes: 2f3d633aa593 ("common/dpaax: add library for PA/VA translation table")
> Cc: shreyansh.jain@nxp.com
> 
> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>

Applied, thanks
diff mbox series

Patch

diff --git a/drivers/common/dpaax/dpaax_iova_table.c b/drivers/common/dpaax/dpaax_iova_table.c
index d54267bb7..19a4e8c58 100644
--- a/drivers/common/dpaax/dpaax_iova_table.c
+++ b/drivers/common/dpaax/dpaax_iova_table.c
@@ -172,7 +172,7 @@  dpaax_iova_table_populate(void)
 	}
 
 	nodes = read_memory_node(&node_count);
-	if (nodes == NULL || node_count <= 0) {
+	if (nodes == NULL) {
 		DPAAX_WARN("PA->VA translation not available;");
 		DPAAX_WARN("Expect performance impact.");
 		return -1;