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 8002545502; Wed, 26 Jun 2024 22:19:00 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6BA0840281; Wed, 26 Jun 2024 22:19:00 +0200 (CEST) Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) by mails.dpdk.org (Postfix) with ESMTP id 6473240274 for ; Wed, 26 Jun 2024 22:18:58 +0200 (CEST) Received: by mail-wr1-f45.google.com with SMTP id ffacd0b85a97d-3621ac606e1so708168f8f.1 for ; Wed, 26 Jun 2024 13:18:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719433138; x=1720037938; darn=dpdk.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=U/QaVa3i4dhj39oCBag8BGAhjgrEyLOruoryZrpNGmY=; b=g2lmziHy8Oj4eDPR7qabWMbkXYaeHpPsRLHpaauxl2ZuySiVxSJ54JYV7vyGszo35J iG+poW0CrQnNIaVvRT9+2UxH+oeiLC3I62lFfgF7bM4ERN90R/fLbqSVeDgK3mwsx9VD JWMEqjiOypuSvLC854fCiT8JgYloxmLT4nzDrch/n/gUtKvttcak72fHgCG5amkJLZEr exTj5At7TKYmkqV6herUL8uJzDwWGXfnJiDmYADUcO30TDYoxNPLlVY+eNydHWpOQmj+ FuQ89hlff0/Iv4QRYwLC0aRLelXvKC79jRTJmIFLKZM6DfxvLzxWQ17dGNMzKZPOL+FB 33Ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719433138; x=1720037938; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=U/QaVa3i4dhj39oCBag8BGAhjgrEyLOruoryZrpNGmY=; b=l1vXC18hnIud1PX+lpG5E0UbAzpVQCgOGw1PNaXEd/vPgEXUJVAGFHM6XIiEf1di4w LFxfADXmjosCHYudPMuhojDNlDogCUxXB85/FU8qlvsaefhzTLK6JQLydmAesnqhvZx3 P9+mmMS3hmhy1qXTsYPDsSKYjc8ArJxZF0RKEIam2Gk+skpFvzGFd6mk4/oRmxNHfxQf BalvvapQuBsHkpFcd4NyMf39xKQNyAoQAh39DHe1vA4mv1YU/48CwOXnD2juguVrrhiF oDGFt7s+VYyQpOQgw8eeSVyoE6UlxftSmRKVDBilQdEmJMKZPXyNPcbAn9qcfxhTxamZ a04g== X-Forwarded-Encrypted: i=1; AJvYcCX6dEXdLsacMfoFvplq2IDrFs0PzrkoketQb87GcymqTIWcuo/0IycHhRSp4RiIJUIFzJwORM06uF14es0= X-Gm-Message-State: AOJu0YxZFqPsRLbibe1TzXJ9/qDtQJ/pxa78lE4pO06LhGLrjTAHHvSG gt98FRN7Y+tt/AEySwj4/2l/Sc2aZPbM06H8+OXwNh6nDIpl/sbZ1zdZGIzG X-Google-Smtp-Source: AGHT+IG7NP3eNPdvp3DDFgCS3wwp5uXmcxrXOP8PFfSblY1aSIwkHiFcXnwSWynm/TEaLQEkUcdufg== X-Received: by 2002:a5d:4648:0:b0:360:8c88:ab82 with SMTP id ffacd0b85a97d-3673cc93496mr602641f8f.30.1719433137119; Wed, 26 Jun 2024 13:18:57 -0700 (PDT) Received: from localhost.localdomain (bba-2-50-153-93.alshamil.net.ae. [2.50.153.93]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3663a8c7c79sm16682222f8f.96.2024.06.26.13.18.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jun 2024 13:18:56 -0700 (PDT) Date: Thu, 27 Jun 2024 00:18:52 +0400 From: Mahmoud Matook To: Kiran Kumar Kokkilagadda Cc: Sunil Kumar Kori , Rakesh Kudurumalla , Nithin Kumar Dabilpuram , Jerin Jacob , "dev@dpdk.org" Subject: Re: [EXTERNAL] [PATCH v2] app/graph: fix destination buffer too small Message-ID: References: <20240623200921.1715890-1-mahmoudmatook.mm@gmail.com> <20240624200114.1792214-1-mahmoudmatook.mm@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: 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 06/25, Kiran Kumar Kokkilagadda wrote: > > > From: Mahmoud Maatuq > Sent: Tuesday, June 25, 2024 1:31 AM > To: Sunil Kumar Kori ; Rakesh Kudurumalla ; Nithin Kumar Dabilpuram ; Jerin Jacob > Cc: dev@dpdk.org; Mahmoud Maatuq > Subject: [EXTERNAL] [PATCH v2] app/graph: fix destination buffer too small > > as sizeof(config. rx. mempool_name) is < sizeof(res->mempool) we should copy at most sizeof(config. rx. mempool_name) and replace memcpy with strlcpy as mempool name is a null terminated string Coverity issue: 415430 Fixes: 3850cb06ab9c ("app/graph:  > > > as sizeof(config.rx.mempool_name) is < sizeof(res->mempool) we should > > copy at most sizeof(config.rx.mempool_name) and replace memcpy with > > strlcpy as mempool name is a null terminated string > > > > Coverity issue: 415430 > > Fixes: 3850cb06ab9c ("app/graph: add ethdev commands") > > Cc: skori@marvell.com > > > > Signed-off-by: Mahmoud Maatuq > > > --- > > v2: > > * replaced memcpy with strlcpy > > --- > > app/graph/ethdev.c | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/app/graph/ethdev.c b/app/graph/ethdev.c > > index cfc1b18569..e7a02b40a9 100644 > > --- a/app/graph/ethdev.c > > +++ b/app/graph/ethdev.c > > @@ -16,6 +16,7 @@ > > > > #include "ethdev_priv.h" > > #include "module_api.h" > > +#include "rte_string_fns.h" > > > > static const char > > cmd_ethdev_mtu_help[] = "ethdev mtu "; > > @@ -671,7 +672,7 @@ cmd_ethdev_parsed(void *parsed_result, __rte_unused struct cmdline *cl, void *da > > memset(&config, 0, sizeof(struct ethdev_config)); > > config.rx.n_queues = res->nb_rxq; > > config.rx.queue_size = ETHDEV_RX_DESC_DEFAULT; > > - memcpy(config.rx.mempool_name, res->mempool, strlen(res->mempool)); > > + strlcpy(config.rx.mempool_name, res->mempool, sizeof(config.rx.mempool_name)); > > > > Can be changed to strlcpy(config.rx.mempool_name, res->mempool->name, sizeof(config.rx.mempool_name)); ? mempool field is of type cmdline_fixed_string_t (array of char) > > > > config.tx.n_queues = res->nb_txq; > > config.tx.queue_size = ETHDEV_TX_DESC_DEFAULT; > > -- > > 2.43.0 > >