From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg1-f193.google.com (mail-pg1-f193.google.com [209.85.215.193]) by dpdk.org (Postfix) with ESMTP id 156604C74 for ; Thu, 28 Feb 2019 23:48:01 +0100 (CET) Received: by mail-pg1-f193.google.com with SMTP id b2so10416952pgl.9 for ; Thu, 28 Feb 2019 14:48:00 -0800 (PST) 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; bh=1uw0eBPFavUXgl6AmiN739e1ePJavyWZMxBzApaX7Eo=; b=cnBQI61QxMSPFX9TUfeRtTfoCO4/NdGL98YRqKUYCL1uqZi7olMiAsFX9iD86OL375 s3ijEPqzHMs9AwkKq3o0eBAys2+I16bKvjHf2yrHvHTYdMymS0O400wzaO0nfk66JiGj JhGlsDgPrqwBbw0EAp4H6XUgnjT+oM5NXsSjpmEOX6sU9Vlg+ME3WVsT5Ubo9ZZe6AQV wR+oYxxaypLbu+rzoJ+qyAwtFxhF+a9PQHBsZYw6+03cmJteLklIg0WaiQvYD0oRFL6L v2RaQ8qZGBkE9duMgrAk69Yo0RgmXDyxVo7ljkl261JSg4b/ZpujB/kzB7Bb7zEQg7WX Uj9g== 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; bh=1uw0eBPFavUXgl6AmiN739e1ePJavyWZMxBzApaX7Eo=; b=CjEbqUVOHwY0DWu26q9Hr4yK+GuYOkdD+b15lYMmvI3b0D2+3Gdec2t2NXk8ihSDPT arezaMjx5v8ZHJvZ/9bpRhkv69l283IkjO0Q3FwhM4OCadZeWHXdS3u4ShoPM2ooq1sO IYMy0RXKwHycfFYSsxvBhc3BX6dE8dyvKX+1YUdhLk3/sKiN11F3YCNVQIBIyvXDESXB cejbUWJdEXBQYPTB2vkGq791Ps5DrFBLzRrUIHy6Ok/GLw5FqUTxm/3ee9+2ecwmHbYj byxcWfMCzB7QzjJkkFM+Kw82l28v0gZ54lzi4eSNoDQjm6aDv3J7tSSQTeyUgF8c3lMA 9Nyg== X-Gm-Message-State: APjAAAUqaHjFsxaPBilAo/B2FTORztdthcueB7vUFj7ah5WiyGw/Nzfh ju+CGz1MBjOvv8mQIyagkSI+j0acye4= X-Google-Smtp-Source: APXvYqzm5VjjPnt1dYe5EOBIXF+KMZiOkHXHLcRox0jLeArJVjS4ZCPzrbt5SMckO8ERDasekWDi1w== X-Received: by 2002:a65:5303:: with SMTP id m3mr1569378pgq.292.1551394079940; Thu, 28 Feb 2019 14:47:59 -0800 (PST) Received: from shemminger-XPS-13-9360.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id r28sm48550833pgl.72.2019.02.28.14.47.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Feb 2019 14:47:59 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Date: Thu, 28 Feb 2019 14:47:54 -0800 Message-Id: <20190228224754.26511-3-stephen@networkplumber.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190228224754.26511-1-stephen@networkplumber.org> References: <20190228224754.26511-1-stephen@networkplumber.org> Subject: [dpdk-dev] [PATCH 2/2] ethdev: use strlcpy instead of snprintf on initialization 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, 28 Feb 2019 22:48:01 -0000 Don't need to use snprintf for simple name copy. Signed-off-by: Stephen Hemminger --- lib/librte_ethdev/rte_ethdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c index 95889ed206db..8bd54dcf58c1 100644 --- a/lib/librte_ethdev/rte_ethdev.c +++ b/lib/librte_ethdev/rte_ethdev.c @@ -459,7 +459,7 @@ rte_eth_dev_allocate(const char *name) } eth_dev = eth_dev_get(port_id); - snprintf(eth_dev->data->name, sizeof(eth_dev->data->name), "%s", name); + strlcpy(eth_dev->data->name, name, RTE_ETH_NAME_MAX_LEN); eth_dev->data->port_id = port_id; eth_dev->data->mtu = ETHER_MTU; -- 2.17.1