From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 98CB045CFC; Thu, 14 Nov 2024 03:38:52 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2A63E42E1D; Thu, 14 Nov 2024 03:38:06 +0100 (CET) Received: from mail-oa1-f45.google.com (mail-oa1-f45.google.com [209.85.160.45]) by mails.dpdk.org (Postfix) with ESMTP id 0061F427B7 for ; Thu, 14 Nov 2024 03:37:58 +0100 (CET) Received: by mail-oa1-f45.google.com with SMTP id 586e51a60fabf-288b392b8daso72003fac.2 for ; Wed, 13 Nov 2024 18:37:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1731551877; x=1732156677; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=TDw3dpqaAyi4LuwkdfC7oJY3HSDuLEShZLnMb9O+nHc=; b=AlN+jt0l8XMWRVfWArTWnVRXH4u9MJrufWwn19gUeEY7wLAV7WITUAaW+KxifPf+kB oZS0QSxyol62ax6Qp2gfElBvyiX3svciCij69mPISvCzg445nUPxJpcuhxL5hmejCeZB Yue8RDuRZYK1ApvGPfsxUXwGCxBkbcq0L8F8O0bRNS3z8ZXiG5luTtEWaN3sYedQ6Yd0 66d2gkFbuR1u/YEtjE1DTtfwTTuhdCbfJpdcRlph3+PDwC497YcjdTdtpmxwFWLEfnfG /P6aZFFpFCwQ2ZI/yFJ7Bl0brOa47U6FzYMLHdSDGEBaZldVvn/wRFf7Z2uGumvfBzjv jeYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731551877; x=1732156677; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TDw3dpqaAyi4LuwkdfC7oJY3HSDuLEShZLnMb9O+nHc=; b=MxJ1c2QXWNBDilZiAdG5C+Hd2RzGtf4aVC3WOu+jO46+TSssim1vgLSRnMoQSV25X0 ms9bhgEfzOcm1lswD5PIGJA9rggfhFXfHNsz9WJSJWWuVeRlv9KedN2d58R8mucYsJvM +3umyKlwacYV3b37G+VGZBk1maveZXJqP29TlwQ0JWbs/Emof2+PX3sDmkLiMk3DvAiQ 7y0seFbJAYyKS9/hCy2NhhGSsMnU5Lt5Vy4bphXJfJb1Zp62N9pdWLTDcJJNeiA0SMHB R/IObP3ahWZPkA6RZFY7UCVWksbAmVn7mecEUi1G47XfdroBCiFDqUyOTkc+3xvvbdvI 00Qw== X-Gm-Message-State: AOJu0Yzdv5b4Ot4q09dhlGLSRkyZspVYTvi2gArCimpLJ/ZbF67I4U6r ny/yOObijm0UHzQrDIhRUVl6tI+ZZg9FP+4czQCSiGNYwCANwNcpQcTapGaoFopMeEBrqim4jOX K X-Google-Smtp-Source: AGHT+IGaeHtP4ziPUnShdtH1W1Zxfd1Ip9GMgBITQdwkMN1PjvMvLc/0JcMOFOqpvPz1M0GrXevdvg== X-Received: by 2002:a05:6871:7998:b0:295:f157:1f82 with SMTP id 586e51a60fabf-296105f8e22mr633488fac.27.1731551877385; Wed, 13 Nov 2024 18:37:57 -0800 (PST) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7246a5d2bb5sm150976b3a.29.2024.11.13.18.37.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Nov 2024 18:37:57 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Christian Koue Muf , Serhii Iliushyk Subject: [PATCH v3 10/11] net/ntnic: check result of malloc Date: Wed, 13 Nov 2024 18:35:59 -0800 Message-ID: <20241114023738.141821-11-stephen@networkplumber.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241114023738.141821-1-stephen@networkplumber.org> References: <20241114011129.451243-1-stephen@networkplumber.org> <20241114023738.141821-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Need to check the result of malloc() before calling memset. This is only place in this driver that forgot, other code does check. Signed-off-by: Stephen Hemminger --- 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.45.2