git.droids-corp.org
/
dpdk.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
9b63492
)
net/nfp: fix memory allocation
author
Alejandro Lucero
<alejandro.lucero@netronome.com>
Wed, 8 Nov 2017 12:07:14 +0000
(12:07 +0000)
committer
Ferruh Yigit
<ferruh.yigit@intel.com>
Fri, 10 Nov 2017 09:31:24 +0000
(09:31 +0000)
If the function actually returns a null value, a null pointer
dereference will occur.
Coverity issue: 195013
Fixes:
dd63df2bfff3
("net/nfp: add NSP symbol resolution command")
Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
drivers/net/nfp/nfp_nspu.c
patch
|
blob
|
history
diff --git
a/drivers/net/nfp/nfp_nspu.c
b/drivers/net/nfp/nfp_nspu.c
index
6ba940c
..
a2819a1
100644
(file)
--- a/
drivers/net/nfp/nfp_nspu.c
+++ b/
drivers/net/nfp/nfp_nspu.c
@@
-411,6
+411,9
@@
nfp_nspu_set_bar_from_symbl(nspu_desc_t *desc, const char *symbl,
int ret = 0;
sym_buf = malloc(desc->buf_size);
+ if (!sym_buf)
+ return -ENOMEM;
+
strncpy(sym_buf, symbl, strlen(symbl));
ret = nspu_command(desc, NSP_CMD_GET_SYMBOL, 1, 1, sym_buf,
NFP_SYM_DESC_LEN, strlen(symbl));