> -----Original Message----- > From: Peng, ZhihongX <zhihongx.p...@intel.com> > Sent: Friday, October 15, 2021 11:11 PM > To: david.march...@redhat.com; Burakov, Anatoly > <anatoly.bura...@intel.com>; Ananyev, Konstantin > <konstantin.anan...@intel.com>; step...@networkplumber.org; > Dumitrescu, Cristian <cristian.dumitre...@intel.com>; Mcnamara, John > <john.mcnam...@intel.com> > Cc: dev@dpdk.org; Lin, Xueqin <xueqin....@intel.com>; Peng, ZhihongX > <zhihongx.p...@intel.com>; sta...@dpdk.org > Subject: [PATCH v10 4/4] performance-thread: Fix cross compilation failed > > From: Zhihong Peng <zhihongx.p...@intel.com> > > 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: sta...@dpdk.org > > Signed-off-by: Xueqin Lin <xueqin....@intel.com> > Signed-off-by: Zhihong Peng <zhihongx.p...@intel.com> > --- > 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
Hi, John Can you give me an ack? Thanks!