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 DD0C2A0032; Tue, 13 Sep 2022 14:18:18 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8177840151; Tue, 13 Sep 2022 14:18:18 +0200 (CEST) Received: from mail-qk1-f176.google.com (mail-qk1-f176.google.com [209.85.222.176]) by mails.dpdk.org (Postfix) with ESMTP id C250C400D6 for ; Tue, 13 Sep 2022 14:18:16 +0200 (CEST) Received: by mail-qk1-f176.google.com with SMTP id u28so5232134qku.2 for ; Tue, 13 Sep 2022 05:18:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date; bh=2km0qnaBdXXKOhcVnqqk5j3g8PNH/3eYTc44aXcY2gg=; b=Y/KXxeZf22iAmy7iFycHUkOzB+wH1wzmgh7+tHVe2iv5m5tFykQM83mFHKNAsdinlI wTC3RKHGqWvFGlsV37ESD/3waJTSsdLCKZYLn3oywrpjqtTgOKZH9j/npoFhOzoAYqEY Bm4OVwFumMfNYNjyGUaPgl/PVmkrqPpJQWDVWnhxz7o1tXUpiREbwpAlYt8HP6vBO4gz /3KMHt6Egndu/aBxQ0i8WISnkpPWFY/aiP+blqXlrYk5gLxelcVNYKwJWpopxXTrUbXZ bN8WG26D+M/y2rw4GyJJaeQwSTNEOZcVqP9u6mUy2YZe/XBPN5fmJWQVCwQMahvWrcQi Sa5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=2km0qnaBdXXKOhcVnqqk5j3g8PNH/3eYTc44aXcY2gg=; b=mKQR3bc8WbN/0BnvFYjI6KUkV3ZgSa38paFXpdXK6y4XO7U/cVG4/ICvHxvb8RJkOw gmahbPWBmwm8i1uf105jxCb+gOQT9tPMX25lJe7tvcrUSaArdq2nMnrRep5geRxiprhi tHPDZOPR9R0RSNhiVqWo2oAdyWHUjzijXcx/8NiIOqgZhVtMTC6EdAgHm9spjRArdnrH DnOEv00Z4bwQK2fu4T0EaJH60Uoq1Mx83/40ez5IIWvGJ069rsbS9mctWxvsO76r9IkC 1h2aps01sW67543wDeuTyOkdhuAbTPXapbo/nZ2SR9JgBL65NXR7z8aFJfYW2c5rh/Rz Uong== X-Gm-Message-State: ACgBeo0dt99tmDTLP4BUD8622ODWUX8jt2pdLAk56UEf3gnFizKUCpcn ufKEEVoODP7MulN3gxqK3dd3iayMDyH6ApFVc9T6tAkXWogyPg== X-Google-Smtp-Source: AA6agR6lexaHPjzH2RUJelF8ppXQ+irK2RsW2tz5kMHDdBMZ6Fa+5xhmgU6M02BuGy5QI2DEAG4DF6tWnjQOKJXLqBk= X-Received: by 2002:a37:9ad5:0:b0:6cd:ef68:19a9 with SMTP id c204-20020a379ad5000000b006cdef6819a9mr11733398qke.22.1663071496077; Tue, 13 Sep 2022 05:18:16 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Jerin Jacob Date: Tue, 13 Sep 2022 17:47:50 +0530 Message-ID: Subject: Re: [PATCH] examples/eventdev: Check for the NULL pointer after calling rte_zmalloc To: 835703180@qq.com Cc: harry.van.haaren@intel.com, dev@dpdk.org Content-Type: text/plain; charset="UTF-8" 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 On Wed, Jul 6, 2022 at 12:54 PM <835703180@qq.com> wrote: > > From: Shiqi Liu <835703180@qq.com> > > As the possible failure of the rte_zmalloc(), the not_checked and > checked could be NULL pointer. > Therefore, it should be better to check it in order to avoid > the dereference of the NULL pointer. > > Fixes: fa8054c8c88 ("examples/eventdev: add thread safe Tx worker pipeline") > Signed-off-by: Shiqi Liu <835703180@qq.com> > --- > examples/eventdev_pipeline/pipeline_worker_tx.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/examples/eventdev_pipeline/pipeline_worker_tx.c b/examples/eventdev_pipeline/pipeline_worker_tx.c > index a82e064c1c..6ea676c516 100644 > --- a/examples/eventdev_pipeline/pipeline_worker_tx.c > +++ b/examples/eventdev_pipeline/pipeline_worker_tx.c > @@ -764,7 +764,9 @@ init_adapters(uint16_t nb_ports) > > ret = rte_event_dev_info_get(evdev_id, &dev_info); > adptr_services = rte_zmalloc(NULL, sizeof(struct rx_adptr_services), 0); > - > + if (adptr_services == NULL) { > + return -ENOMEM; > + } it does not look like you have tried to compile this patch. It is a void return function. CI: http://mails.dpdk.org/archives/test-report/2022-July/294780.html Also, Please update the subject. Some suggestion to consider. examples/eventdev: validate memory allocation > struct rte_event_port_conf adptr_p_conf = { > .dequeue_depth = cdata.worker_cq_depth, > .enqueue_depth = 64, > -- > 2.35.1.windows.2 >