All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net/nfp: fix memory allocation
@ 2017-11-08 12:07 Alejandro Lucero
  2017-11-10  9:39 ` Ferruh Yigit
  0 siblings, 1 reply; 2+ messages in thread
From: Alejandro Lucero @ 2017-11-08 12:07 UTC (permalink / raw)
  To: dev; +Cc: stable

If the function actually returns a null value, a null pointer
dereference will occur.

Fixes: dd63df2bfff3 ("net/nfp: add NSP symbol resolution command")
Coverity: 195013

Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
---
 drivers/net/nfp/nfp_nspu.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/nfp/nfp_nspu.c b/drivers/net/nfp/nfp_nspu.c
index 6ba940c..a2819a1 100644
--- a/drivers/net/nfp/nfp_nspu.c
+++ b/drivers/net/nfp/nfp_nspu.c
@@ -411,6 +411,9 @@
 	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));
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] net/nfp: fix memory allocation
  2017-11-08 12:07 [PATCH] net/nfp: fix memory allocation Alejandro Lucero
@ 2017-11-10  9:39 ` Ferruh Yigit
  0 siblings, 0 replies; 2+ messages in thread
From: Ferruh Yigit @ 2017-11-10  9:39 UTC (permalink / raw)
  To: Alejandro Lucero, dev; +Cc: stable

On 11/8/2017 4:07 AM, Alejandro Lucero wrote:
> If the function actually returns a null value, a null pointer
> dereference will occur.
> 
> Fixes: dd63df2bfff3 ("net/nfp: add NSP symbol resolution command")
> Coverity: 195013
> 
> Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>

Applied to dpdk/master, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-11-10  9:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-08 12:07 [PATCH] net/nfp: fix memory allocation Alejandro Lucero
2017-11-10  9:39 ` Ferruh Yigit

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.