From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: Re: [PATCH] eal: Add the check for null peer pointer in mp request handler Date: Wed, 19 Dec 2018 23:45:07 +0100 Message-ID: <3715484.jA0p6cb1Xu@xps> References: <1543990764-32140-1-git-send-email-gfree.wind@vip.163.com> <23a41184-d366-ca83-4815-143ac350735e@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Cc: dev@dpdk.org, "Burakov, Anatoly" , gfree.wind@vip.163.com To: Gao Feng Return-path: Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by dpdk.org (Postfix) with ESMTP id ABF3210A3 for ; Wed, 19 Dec 2018 23:45:10 +0100 (CET) In-Reply-To: <23a41184-d366-ca83-4815-143ac350735e@intel.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 10/12/2018 17:41, Burakov, Anatoly: > On 05-Dec-18 6:19 AM, gfree.wind@vip.163.com wrote: > > From: Gao Feng > > > > Add the check for null peer pointer like the bundle pointer in the mp request > > handler. They should follow same style. And add some logs for nomem cases. > > > > Signed-off-by: Gao Feng > > --- > > lib/librte_eal/common/hotplug_mp.c | 15 +++++++++++++++ > > 1 file changed, 15 insertions(+) > > > > diff --git a/lib/librte_eal/common/hotplug_mp.c b/lib/librte_eal/common/hotplug_mp.c > > index 070e2e0..0d2996f 100644 > > --- a/lib/librte_eal/common/hotplug_mp.c > > +++ b/lib/librte_eal/common/hotplug_mp.c > > @@ -200,6 +200,11 @@ static int cmp_dev_name(const struct rte_device *dev, const void *_name) > > * when it is ready. > > */ > > bundle->peer = strdup(peer); > > + if (bundle->peer == NULL) { > > + free(bundle); > > + RTE_LOG(ERR, EAL, "not enough memory\n"); > > The error should probably be more descriptive (as in, it should be > easier to identify where it came from). Suggested rewording: > > "hotplug: cannot allocate memory for bundle" > > or something along those lines. Same for other log messages. > > As for actual code, > > Acked-by: Anatoly Burakov Applied, thanks