From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: Re: [PATCH v2] mem: memory leaks of hubedir caused by strdup Date: Tue, 17 Apr 2018 13:47:43 +0200 Message-ID: <1581625.s6OpJcviaZ@xps> References: <6821483b-30f3-ac79-208c-406fb46685af@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Cc: dev@dpdk.org, "Burakov, Anatoly" , bruce.richardson@intel.com To: zhouyangchao Return-path: Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) by dpdk.org (Postfix) with ESMTP id D1B578E5B for ; Tue, 17 Apr 2018 13:47:45 +0200 (CEST) In-Reply-To: List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" I see no reason to accept this patch, replacing strdup by snprintf, given that we have strlcpy. Please do a v3 with strlcpy. 17/04/2018 13:16, zhouyangchao: > As Burakov said, for no other reason, I just followed the old version. > > On Tue, Apr 17, 2018 at 6:31 PM Burakov, Anatoly > wrote: > > > On 17-Apr-18 11:24 AM, Thomas Monjalon wrote: > > > 17/04/2018 12:06, Yangchao Zhou: > > >> Coverity issue: 272585 > > >> Fixes: cb97d93e9d3b ("mem: share hugepage info primary and secondary") > > >> > > >> Signed-off-by: Yangchao Zhou > > >> Acked-by: Anatoly Burakov > > > > > > Better to provide a small explanation. > > > > > >> - retval = strdup(splitstr[MOUNTPT]); > > >> + snprintf(hugedir, len, "%s", > > splitstr[MOUNTPT]); > > > > > > I think it is candidate to be replaced by strlcpy. > > > Please check > > > > > > > Yes, it seems that strlcpy thingie was merged without much fanfare. I'll > > be submitting a patch fixing various usages of snprintf in my recent > > commits. I'm inclined to leave this as is for this commit, as it's not > > the purpose of this fix.