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 7B30FA04C0 for ; Fri, 25 Sep 2020 14:44:00 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1AB0B1E975; Fri, 25 Sep 2020 14:44:00 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id F35341E965; Fri, 25 Sep 2020 14:43:56 +0200 (CEST) IronPort-SDR: +hSg7PEogB3SlSDiMrmcmW+LaSprZwkTOq06aesRpMM6gSqKyTVVOIFumgUhORsXYyXT+Rb/XC SEXJUmzwVp/Q== X-IronPort-AV: E=McAfee;i="6000,8403,9754"; a="161602722" X-IronPort-AV: E=Sophos;i="5.77,302,1596524400"; d="scan'208";a="161602722" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Sep 2020 05:43:55 -0700 IronPort-SDR: KbLlpYtU/SaTlmnVCwswUPNw04WexQ/o0ivSgW2obhzQpknTyyVeJ1qqpw0T6Q587ps/CfiViv PoZUktwjnyQA== X-IronPort-AV: E=Sophos;i="5.77,302,1596524400"; d="scan'208";a="487455842" Received: from fyigit-mobl1.ger.corp.intel.com (HELO [10.252.10.211]) ([10.252.10.211]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Sep 2020 05:43:54 -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> From: Ferruh Yigit Message-ID: <4801cf86-8a4d-f63f-d240-0176b6b51abb@intel.com> Date: Fri, 25 Sep 2020 13:43:50 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.2.2 MIME-Version: 1.0 In-Reply-To: <20200922172015.266698-1-kevin.laatz@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 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 :)