[dpdk-dev] [PATCH] eal: Add the check for null peer pointer in mp request handler

Thomas Monjalon thomas at monjalon.net
Wed Dec 19 23:45:07 CET 2018


10/12/2018 17:41, Burakov, Anatoly:
> On 05-Dec-18 6:19 AM, gfree.wind at vip.163.com wrote:
> > From: Gao Feng <davidfgao at tencent.com>
> > 
> > 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 <davidfgao at tencent.com>
> > ---
> >   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 <anatoly.burakov at intel.com>

Applied, thanks




More information about the dev mailing list