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 532C645D07; Thu, 14 Nov 2024 19:46:07 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6B63942EED; Thu, 14 Nov 2024 19:45:17 +0100 (CET) Received: from mail-pj1-f49.google.com (mail-pj1-f49.google.com [209.85.216.49]) by mails.dpdk.org (Postfix) with ESMTP id 2AEF742EF9 for ; Thu, 14 Nov 2024 19:45:11 +0100 (CET) Received: by mail-pj1-f49.google.com with SMTP id 98e67ed59e1d1-2e31af47681so778446a91.2 for ; Thu, 14 Nov 2024 10:45:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1731609910; x=1732214710; 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=OpGXFSmqWl/W4srRLTAKFbp/vEjFPjcM+z6YOjWi3n08iu7lL6auWQl0eWYRGiZOYh ZbO4/XJy6ett84t2+ska6+5fjpHG4gOv1d3azQ932W8+MrS/4+dEeR5iXPSA3rB/TgdA 04A7RFV1pF8IcW2HWarnVYzfrkIkd0PAV+WT4PLOx5H1njB59pH+U1bi3hpsyXWknQCG /+o4kFC8stfLIPibwZKiVRmej0c5f/GyrfFqmdl84vFZlcSyxmatApdrNYTsST9ZY3ew hjfYOu67ti985LIh//bU4qtI/vYwgvFTC/kPuGoHqbuqwnKKsrQX8AjDB+J8vpZ5XCb+ 8pLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731609910; x=1732214710; 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=mQv2TtAK2gl5GIPeNncZb9Om1K7qs4DQ4st6hNm6x+Y84dBvZsQdaNDwrrSGgML/r2 wlZpoHuryRNMyUi5MXzYMX9bnVmzMx75+ghh8PnShiwsP5C6lbBRdtx411KGFC6DRuv7 eqvI3GfOTHxBncUMvEJtTfQLja/ovemCIffrVaeMlE+1Vx9mSwR4tUCa8SQ3rLhJ5u3J NVFu/VVHCj38+eZNOykC0tkLZDEvEj1KIAYYVoUcb0BGd7dJ8PJENoOTiGh8liqb6yw4 aJt5MCu0VeSLFmz1x2IPrq6/gvyp/UIiosMx/vN7R4nAQzTwpLw+b4PZnhivDOH7pff0 iS6Q== X-Gm-Message-State: AOJu0YzqMzOAQIH8PmMWjyam57IkM3yz6yPxlqHfaexl8onee6SwI3Nn v7Md79kmY1m7KxpAikllsHiA2xCY/l6KNuPkZpsqMkuiUm59xnK7Jx684UYxf/mTp6yvT98cDTD V8LI= X-Google-Smtp-Source: AGHT+IE0KaTXcR17ymH8Ki3ZmBxSyCpEuxpWBFUlIlnzBsmt1AJD18cSapa9XIN63TqY2M0r/wLLeg== X-Received: by 2002:a17:90b:2548:b0:2e2:e092:5323 with SMTP id 98e67ed59e1d1-2e9f2d5cc36mr9759280a91.29.1731609910330; Thu, 14 Nov 2024 10:45:10 -0800 (PST) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2ea06ef71a6sm1517611a91.8.2024.11.14.10.45.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Nov 2024 10:45:10 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Christian Koue Muf , Serhii Iliushyk Subject: [PATCH v4 10/12] net/ntnic: check result of malloc Date: Thu, 14 Nov 2024 10:43:32 -0800 Message-ID: <20241114184452.31854-11-stephen@networkplumber.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241114184452.31854-1-stephen@networkplumber.org> References: <20241114011129.451243-1-stephen@networkplumber.org> <20241114184452.31854-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