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 5D4B9A04BA; Wed, 7 Oct 2020 12:29:37 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 316C01B62E; Wed, 7 Oct 2020 12:29:36 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 0E9621B62B for ; Wed, 7 Oct 2020 12:29:32 +0200 (CEST) IronPort-SDR: wWsc/2WuiqvHoLRa/VK90J0JDP6WcdoJ9AvKeYE1c2tJo8jwEKu2IN+969S8VF/DJlpyMLO8EA mLFrkNiOimSQ== X-IronPort-AV: E=McAfee;i="6000,8403,9766"; a="162270552" X-IronPort-AV: E=Sophos;i="5.77,346,1596524400"; d="scan'208";a="162270552" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Oct 2020 03:29:32 -0700 IronPort-SDR: 2MMnoxNCxqByxAcUnaZFAoM3Wd/Ot4hoKqHiXpWa0rvShib+GEVpzc4QcDvxSVlR1Hyg+gA4rp fn24d3dB7Bgg== X-IronPort-AV: E=Sophos;i="5.77,346,1596524400"; d="scan'208";a="461267999" Received: from bricha3-mobl.ger.corp.intel.com ([10.213.1.245]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-SHA; 07 Oct 2020 03:29:30 -0700 Date: Wed, 7 Oct 2020 11:29:26 +0100 From: Bruce Richardson To: Ciara Loftus Cc: dev@dpdk.org Message-ID: <20201007102926.GD680@bricha3-MOBL.ger.corp.intel.com> References: <20201007092050.27485-1-ciara.loftus@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201007092050.27485-1-ciara.loftus@intel.com> Subject: Re: [dpdk-dev] [PATCH v2] net/af_xdp: use strlcpy instead of strncpy X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Wed, Oct 07, 2020 at 09:20:50AM +0000, Ciara Loftus wrote: > strncpy may leave the destination buffer not NULL terminated so use > strlcpy instead. > > Coverity issue: 362975 > Fixes: 339b88c6a91f ("net/af_xdp: support multi-queue") > Signed-off-by: Ciara Loftus > --- Acked-by: Bruce Richardson If the community prefers using rte_strscpy, this ack can also apply to v4 too. :-) > v2: > * use strlcpy instead of snprintf > > drivers/net/af_xdp/rte_eth_af_xdp.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c > index eaf2c9c873..ac00cbab8e 100644 > --- a/drivers/net/af_xdp/rte_eth_af_xdp.c > +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c > @@ -1362,7 +1362,7 @@ xdp_get_channels_info(const char *if_name, int *max_queues, > > channels.cmd = ETHTOOL_GCHANNELS; > ifr.ifr_data = (void *)&channels; > - strncpy(ifr.ifr_name, if_name, IFNAMSIZ); > + strlcpy(ifr.ifr_name, if_name, IFNAMSIZ); > ret = ioctl(fd, SIOCETHTOOL, &ifr); > if (ret) { > if (errno == EOPNOTSUPP) { > -- > 2.17.1 >