From patchwork Tue May 8 04:30:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Green X-Patchwork-Id: 39443 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 13A075323; Tue, 8 May 2018 07:05:49 +0200 (CEST) Received: from mail.warmcat.com (mail.warmcat.com [163.172.24.82]) by dpdk.org (Postfix) with ESMTP id 0E142235 for ; Tue, 8 May 2018 07:05:43 +0200 (CEST) From: Andy Green To: dev@dpdk.org Date: Tue, 08 May 2018 12:30:13 +0800 Message-ID: <152575381332.56689.17827274556476490336.stgit@localhost.localdomain> In-Reply-To: <152575364588.56689.3300796065057551728.stgit@localhost.localdomain> References: <152575364588.56689.3300796065057551728.stgit@localhost.localdomain> User-Agent: StGit/unknown-version Subject: [dpdk-dev] [PATCH 09/18] drivers: net: qede: fix strncpy constant and NUL 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" Acked-by: Shahed Shaikh --- drivers/net/qede/base/ecore_int.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/net/qede/base/ecore_int.c b/drivers/net/qede/base/ecore_int.c index f43781ba4..c809d84ef 100644 --- a/drivers/net/qede/base/ecore_int.c +++ b/drivers/net/qede/base/ecore_int.c @@ -1103,10 +1103,12 @@ static enum _ecore_status_t ecore_int_deassertion(struct ecore_hwfn *p_hwfn, OSAL_SNPRINTF(bit_name, 30, p_aeu->bit_name, num); - else - OSAL_STRNCPY(bit_name, - p_aeu->bit_name, - 30); + else { + strncpy(bit_name, + p_aeu->bit_name, + sizeof(bit_name) - 1); + bit_name[sizeof(bit_name) - 1] = '\0'; + } /* We now need to pass bitmask in its * correct position.