patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
	stable@dpdk.org, Christian Koue Muf <ckm@napatech.com>,
	Serhii Iliushyk <sil-plv@napatech.com>,
	Ferruh Yigit <ferruh.yigit@amd.com>
Subject: [PATCH v8 15/17] net/ntnic: check result of malloc
Date: Sun, 16 Feb 2025 08:53:14 -0800	[thread overview]
Message-ID: <20250216170110.7230-16-stephen@networkplumber.org> (raw)
In-Reply-To: <20250216170110.7230-1-stephen@networkplumber.org>

Need to check the result of malloc() before calling memset.
This is only place in this driver that forgot, other code
does check.

Fixes: 0d9bca480e26 ("net/ntnic: add FPGA modules for initialization")
cc: stable@dpdk.org
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/net/ntnic/nthw/nthw_rac.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ntnic/nthw/nthw_rac.c b/drivers/net/ntnic/nthw/nthw_rac.c
index ca6aba6db2..f275e64da3 100644
--- a/drivers/net/ntnic/nthw/nthw_rac.c
+++ b/drivers/net/ntnic/nthw/nthw_rac.c
@@ -31,7 +31,9 @@
 nthw_rac_t *nthw_rac_new(void)
 {
 	nthw_rac_t *p = malloc(sizeof(nthw_rac_t));
-	memset(p, 0, sizeof(nthw_rac_t));
+
+	if (p)
+		memset(p, 0, sizeof(nthw_rac_t));
 	return p;
 }
 
-- 
2.47.2


  parent reply	other threads:[~2025-02-16 17:01 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20241114011129.451243-1-stephen@networkplumber.org>
     [not found] ` <20241114015405.77060-1-stephen@networkplumber.org>
2024-11-14  1:52   ` [PATCH v2 4/8] crypto/qat: fix size calculation for memset Stephen Hemminger
     [not found] ` <20241114023738.141821-1-stephen@networkplumber.org>
2024-11-14  2:35   ` [PATCH v3 04/11] " Stephen Hemminger
     [not found] ` <20241114184452.31854-1-stephen@networkplumber.org>
2024-11-14 18:43   ` [PATCH v4 04/12] " Stephen Hemminger
     [not found] ` <20250211173720.1188517-1-stephen@networkplumber.org>
2025-02-11 17:35   ` [PATCH v5 04/11] " Stephen Hemminger
2025-02-11 17:35   ` [PATCH v5 09/11] net/ntnic: check result of malloc Stephen Hemminger
     [not found] ` <20250213221819.1856769-1-stephen@networkplumber.org>
2025-02-13 22:16   ` [PATCH v6 04/11] crypto/qat: fix size calculation for memset Stephen Hemminger
2025-02-13 22:16   ` [PATCH v6 09/11] net/ntnic: check result of malloc Stephen Hemminger
     [not found] ` <20250215190544.988310-1-stephen@networkplumber.org>
2025-02-15 19:04   ` [PATCH v7 09/16] crypto/qat: fix size calculation for memset Stephen Hemminger
2025-02-15 19:04   ` [PATCH v7 14/16] net/ntnic: check result of malloc Stephen Hemminger
     [not found] ` <20250216170110.7230-1-stephen@networkplumber.org>
2025-02-16 16:53   ` [PATCH v8 10/17] crypto/qat: fix size calculation for memset Stephen Hemminger
2025-02-16 16:53   ` Stephen Hemminger [this message]
     [not found] ` <20250220164151.9606-1-stephen@networkplumber.org>
2025-02-20 16:27   ` [PATCH v9 08/15] " Stephen Hemminger
2025-02-20 16:27   ` [PATCH v9 13/15] net/ntnic: check result of malloc Stephen Hemminger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250216170110.7230-16-stephen@networkplumber.org \
    --to=stephen@networkplumber.org \
    --cc=ckm@napatech.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@amd.com \
    --cc=sil-plv@napatech.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).