From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf0-f193.google.com (mail-pf0-f193.google.com [209.85.192.193]) by dpdk.org (Postfix) with ESMTP id 6F63DE5D for ; Thu, 29 Mar 2018 19:05:36 +0200 (CEST) Received: by mail-pf0-f193.google.com with SMTP id c78so3650825pfj.6 for ; Thu, 29 Mar 2018 10:05:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=HlStG0bMQZp0PCVVNc0FeQqpN2kodBO2FuXSilKotRQ=; b=jh0d9G7Ukq5pxnpkPYEFUP4FZbVcqd0rTBZSljLb2BhfRPYYnX9ywllmAhOAclDgqu 5e2LzrLesJMIuR2Wx0Ux2Rt6W9hPCozPJlv6p63YxObhNFiA3TIzay9Egls2RL3mGAiP iyk57iNeHJEV747zNmIt5x18nZldXPvRXyTxUuMlLIqeG8YloIvuAloVn2pu6p1EbmdX Ppzg94CNiFdeHl2sG1CiSeyvdqTiOfzMuFJL5mjCQ2Oj+wPi+89onaB26GXWoKZRFyir PjTd331pn+5W9Kw3ANFc6EaAQBFNgq4JuQnjD9r2F8BCeUfk04z0jkx+XUPOMbl9lNjX ihyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=HlStG0bMQZp0PCVVNc0FeQqpN2kodBO2FuXSilKotRQ=; b=J76DIYOQF8J0ZEr5U91+WXQT5k5ZVtQxRWZeA2kca7+LrHQvwuQ+5c/s7tFor8TLgn GykEFaMqtzNrPglB1XcFa6JR15ownnJiIQ4+MpNcM5HhgR4Zvv/ar9XwbuqOVLdAA92q 5BA5jRSw9lzrRUw4ljtZ6YHjWDLg9d/VGiSHz8FXkM8R4HtOuw3xJFUView0AdPhf10s SiKf8/tflwTZN5pto3eS6qFfwatlGIeUiRmBF23AmTJGbT4qiRWv5VuIIMwgIfOGJBfg WSl2O9+COg4iw2qxE9IUCcLcnl9aSrAyGPJNIDH1tvqHjJbpELcEp9zIdaMN2p8HghNE 7Pyg== X-Gm-Message-State: AElRT7FLpu0UBzdYAuOEKMQweVhHyh9lHXq+Lb/wBc2ylj1Qiux/jUph /Ue+cZr016rtN5gSq1LEoaGCl8xEFl8= X-Google-Smtp-Source: AIpwx48szJWNhaWx8g3qnuMzsnk1s+codRVo7Hm1FueS9XfMBndPD7gjUNbCj4esH/UqL315lNFhyg== X-Received: by 2002:a17:902:aa5:: with SMTP id 34-v6mr8072011plp.367.1522343135294; Thu, 29 Mar 2018 10:05:35 -0700 (PDT) Received: from xeon-e3.lan (204-195-71-95.wavecable.com. [204.195.71.95]) by smtp.gmail.com with ESMTPSA id p1sm12748631pgr.67.2018.03.29.10.05.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 29 Mar 2018 10:05:34 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Date: Thu, 29 Mar 2018 10:05:30 -0700 Message-Id: <20180329170531.2478-2-stephen@networkplumber.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180329170531.2478-1-stephen@networkplumber.org> References: <20180329170531.2478-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v3 1/2] rte_mbuf: fix strncpy warnings 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: , X-List-Received-Date: Thu, 29 Mar 2018 17:05:36 -0000 Gcc-8 discovers issue with platform_mempool_ops. rte_mbuf_pool_ops.c:26:3: error: ‘strncpy’ output truncated before terminating nul copying as many bytes from a string as its length [-Werror=stringop-truncation] strncpy(mz->addr, ops_name, strlen(ops_name)); Since the ops_name is already checked for size, using strncpy here is unnecessary; just use strcpy. Fixes: a3acc3144a76 ("mbuf: add pool ops selection functions") Signed-off-by: Stephen Hemminger --- lib/librte_mbuf/rte_mbuf_pool_ops.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/librte_mbuf/rte_mbuf_pool_ops.c b/lib/librte_mbuf/rte_mbuf_pool_ops.c index 48cc342002a5..a1d4699f67fe 100644 --- a/lib/librte_mbuf/rte_mbuf_pool_ops.c +++ b/lib/librte_mbuf/rte_mbuf_pool_ops.c @@ -23,7 +23,7 @@ rte_mbuf_set_platform_mempool_ops(const char *ops_name) RTE_MEMPOOL_OPS_NAMESIZE, SOCKET_ID_ANY, 0); if (mz == NULL) return -rte_errno; - strncpy(mz->addr, ops_name, strlen(ops_name)); + strcpy(mz->addr, ops_name); return 0; } else if (strcmp(mz->addr, ops_name) == 0) { return 0; @@ -62,7 +62,7 @@ rte_mbuf_set_user_mempool_ops(const char *ops_name) return -rte_errno; } - strncpy(mz->addr, ops_name, strlen(ops_name)); + strcpy(mz->addr, ops_name); return 0; } -- 2.16.2