From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id E082BA04BA for ; Thu, 1 Oct 2020 16:51:53 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D085E1D455; Thu, 1 Oct 2020 16:51:52 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id 28D201D15A; Thu, 1 Oct 2020 16:51:50 +0200 (CEST) IronPort-SDR: XBNOdeXj0e3uMrs0RZTNXgR64Lq5hpcaCSJwjjbteEhA3F+87pKBJbqKJmWfkEfMpZjGQu8s4h 8/wRw4cdpU7w== X-IronPort-AV: E=McAfee;i="6000,8403,9760"; a="142143303" X-IronPort-AV: E=Sophos;i="5.77,323,1596524400"; d="scan'208";a="142143303" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Oct 2020 07:51:46 -0700 IronPort-SDR: PSdaf2fQw8zbYI8XePNcIBm6JCobu4MIaxE7UKIgaZlc3DFNMBse3kLBp2i1vaj56b1enTwhvP T0UiMDy/hYrw== X-IronPort-AV: E=Sophos;i="5.77,323,1596524400"; d="scan'208";a="503951050" Received: from fyigit-mobl1.ger.corp.intel.com (HELO [10.213.253.63]) ([10.213.253.63]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Oct 2020 07:51:44 -0700 To: Kevin Laatz , dev@dpdk.org Cc: bruce.richardson@intel.com, stable@dpdk.org, David Marchand , Stephen Hemminger References: <20200922172015.266698-1-kevin.laatz@intel.com> <4801cf86-8a4d-f63f-d240-0176b6b51abb@intel.com> <6eceabb8-ab9c-8774-46d9-b5ffef5cdab7@intel.com> From: Ferruh Yigit Message-ID: <8e441cd7-b6f4-fd46-7448-c116a41a295d@intel.com> Date: Thu, 1 Oct 2020 15:51:38 +0100 MIME-Version: 1.0 In-Reply-To: <6eceabb8-ab9c-8774-46d9-b5ffef5cdab7@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [dpdk-stable] [PATCH] net/ring: fix unchecked return value X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" On 10/1/2020 3:14 PM, Kevin Laatz wrote: > > On 25/09/2020 13:43, Ferruh Yigit wrote: >> On 9/22/2020 6:20 PM, Kevin Laatz wrote: >>> Add a check for the return value of the sscanf call in >>> parse_internal_args(), returning an error if we don't get the expected >>> result. >>> >>> Coverity issue: 362049 >>> Fixes: 96cb19521147 ("net/ring: use EAL APIs in PMD specific API") >>> Cc: stable@dpdk.org >>> >>> Signed-off-by: Kevin Laatz >>> --- >>>   drivers/net/ring/rte_eth_ring.c | 3 ++- >>>   1 file changed, 2 insertions(+), 1 deletion(-) >>> >>> diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c >>> index 40fe1ca4ba..62060e46ce 100644 >>> --- a/drivers/net/ring/rte_eth_ring.c >>> +++ b/drivers/net/ring/rte_eth_ring.c >>> @@ -539,7 +539,8 @@ parse_internal_args(const char *key __rte_unused, const >>> char *value, >>>       struct ring_internal_args **internal_args = data; >>>       void *args; >>>   -    sscanf(value, "%p", &args); >>> +    if (sscanf(value, "%p", &args) != 1) >>> +        return -1; >> >> I am aware that this is just to fix the coverity error to check the return >> value, BUT :) >> >> The internal args is mainly to pass the information get by API >> ('rte_eth_from_ring()') to ring probe. And the main information to pass is the >> ring. >> It may be possible to pass the ring_name only and eliminate internal args >> completely, the driver already has a way to pass ring name: >> "nodeaction=name:node:ATTACH" devargs. >> >> If you have time, can you please check if it can be possible to fill and pass >> the nodeaction devargs in 'rte_eth_from_rings()' and eliminate the 'internal' >> devargs completely? >> If it works, as a bonus it will resolve above coverity issue by removing it :) >> > Hi Ferruh, > > It seems to be used for more than just that - after the parsing, the internal > args are passed to do_eth_dev_ring_create() as multiple parameters. > Yes multiple args passed to 'do_eth_dev_ring_create()' from internal arg, and they may be provided via existing nodeaction arg too, needs to be checked. Anyway, the option to eliminate the internal args is just a good to have, we can check it later instead making the this coverity fix more complex.