summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlejandro Lucero <alejandro.lucero@netronome.com>2017-11-08 14:36:32 +0000
committerFerruh Yigit <ferruh.yigit@intel.com>2017-11-10 09:31:24 +0000
commitfee720e9292529c08f6a80ed05bd47d559812916 (patch)
treeb88f20091ec174ab9a78902a992e5fd27c014a14
parent1fdbf9b06a45d78f0f94b9c793847047070d6827 (diff)
downloaddpdk-fee720e9292529c08f6a80ed05bd47d559812916.zip
dpdk-fee720e9292529c08f6a80ed05bd47d559812916.tar.gz
dpdk-fee720e9292529c08f6a80ed05bd47d559812916.tar.xz
net/nfp: fix null pointer check
First, the received pointer was not checked before. Then the pointer from malloc was not the one used in the existing check. Coverity issue: 195027 Fixes: ad60bca34899 ("net/nfp: read PF port MAC addr using NSP") Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
-rw-r--r--drivers/net/nfp/nfp_nspu.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/net/nfp/nfp_nspu.c b/drivers/net/nfp/nfp_nspu.c
index 39d14e6..0b415fc 100644
--- a/drivers/net/nfp/nfp_nspu.c
+++ b/drivers/net/nfp/nfp_nspu.c
@@ -618,10 +618,14 @@ nfp_nsp_eth_read_table(nspu_desc_t *desc, union eth_table_entry **table)
{
int ret;
+ if (!table)
+ return -EINVAL;
+
RTE_LOG(INFO, PMD, "Reading hw ethernet table...\n");
+
/* port 0 allocates the eth table and read it using NSPU */
*table = malloc(NSP_ETH_TABLE_SIZE);
- if (!table)
+ if (!*table)
return -ENOMEM;
ret = nspu_command(desc, NSP_CMD_READ_ETH_TABLE, 1, 0, *table,