From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1B087A0548; Fri, 15 Oct 2021 16:28:14 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 34C1B4126A; Fri, 15 Oct 2021 16:28:05 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mails.dpdk.org (Postfix) with ESMTP id 9FAC24124D; Fri, 15 Oct 2021 16:28:01 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10137"; a="291403803" X-IronPort-AV: E=Sophos;i="5.85,375,1624345200"; d="scan'208";a="291403803" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Oct 2021 07:28:01 -0700 X-IronPort-AV: E=Sophos;i="5.85,375,1624345200"; d="scan'208";a="627313821" Received: from unknown (HELO localhost.localdomain) ([10.240.183.65]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Oct 2021 07:27:58 -0700 From: zhihongx.peng@intel.com To: david.marchand@redhat.com, anatoly.burakov@intel.com, konstantin.ananyev@intel.com, stephen@networkplumber.org, cristian.dumitrescu@intel.com, john.mcnamara@intel.com Cc: dev@dpdk.org, xueqin.lin@intel.com, Zhihong Peng , stable@dpdk.org Date: Fri, 15 Oct 2021 22:27:39 +0800 Message-Id: <20211015142739.1876210-4-zhihongx.peng@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211015142739.1876210-1-zhihongx.peng@intel.com> References: <20211012094318.1154727-3-zhihongx.peng@intel.com> <20211015142739.1876210-1-zhihongx.peng@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v10 4/4] performance-thread: Fix cross compilation failed X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" From: Zhihong Peng The gcc(arm-linux-gcc) will check code more stricter when ASan enabled. "strncpy specified bound XX equals destination size" error occurs here. Fixes: 116819b9ed0d ("examples/performance-thread: add lthread subsystem") Cc: stable@dpdk.org Signed-off-by: Xueqin Lin Signed-off-by: Zhihong Peng --- examples/performance-thread/common/lthread.c | 2 +- examples/performance-thread/common/lthread_cond.c | 4 ++-- examples/performance-thread/common/lthread_mutex.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/performance-thread/common/lthread.c b/examples/performance-thread/common/lthread.c index 3f1f48db43..dd4b3b27ee 100644 --- a/examples/performance-thread/common/lthread.c +++ b/examples/performance-thread/common/lthread.c @@ -463,6 +463,6 @@ void lthread_set_funcname(const char *f) { struct lthread *lt = THIS_LTHREAD; - strncpy(lt->funcname, f, sizeof(lt->funcname)); + strncpy(lt->funcname, f, sizeof(lt->funcname) - 1); lt->funcname[sizeof(lt->funcname)-1] = 0; } diff --git a/examples/performance-thread/common/lthread_cond.c b/examples/performance-thread/common/lthread_cond.c index cdcc7a7b5a..6ec8bc7e82 100644 --- a/examples/performance-thread/common/lthread_cond.c +++ b/examples/performance-thread/common/lthread_cond.c @@ -57,9 +57,9 @@ lthread_cond_init(char *name, struct lthread_cond **cond, } if (name == NULL) - strncpy(c->name, "no name", sizeof(c->name)); + strncpy(c->name, "no name", sizeof(c->name) - 1); else - strncpy(c->name, name, sizeof(c->name)); + strncpy(c->name, name, sizeof(c->name) - 1); c->name[sizeof(c->name)-1] = 0; c->root_sched = THIS_SCHED; diff --git a/examples/performance-thread/common/lthread_mutex.c b/examples/performance-thread/common/lthread_mutex.c index 01da6cad4f..7e5da609b1 100644 --- a/examples/performance-thread/common/lthread_mutex.c +++ b/examples/performance-thread/common/lthread_mutex.c @@ -52,9 +52,9 @@ lthread_mutex_init(char *name, struct lthread_mutex **mutex, } if (name == NULL) - strncpy(m->name, "no name", sizeof(m->name)); + strncpy(m->name, "no name", sizeof(m->name) - 1); else - strncpy(m->name, name, sizeof(m->name)); + strncpy(m->name, name, sizeof(m->name) - 1); m->name[sizeof(m->name)-1] = 0; m->root_sched = THIS_SCHED; -- 2.25.1