From: "Burakov, Anatoly" Subject: Re: [PATCH v2] mem: memory leaks of hubedir caused by strdup Date: Tue, 17 Apr 2018 11:31:09 +0100 Message-ID: References: <6821483b-30f3-ac79-208c-406fb46685af@intel.com> <1523959561-17400-1-git-send-email-zhouyates@gmail.com> <1581620.t7eghVUmVK@xps> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Cc: dev@dpdk.org, bruce.richardson@intel.com To: Thomas Monjalon , Yangchao Zhou Return-path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 4A2C6A823 for ; Tue, 17 Apr 2018 12:31:13 +0200 (CEST) In-Reply-To: <1581620.t7eghVUmVK@xps> Content-Language: en-US List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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. -- Thanks, Anatoly