[dpdk-dev] [PATCH] event/opdl: fix sprintf with snprintf

Jerin Jacob Kollanukkaran jerinj at marvell.com
Mon Mar 11 14:52:11 CET 2019


On Mon, 2019-03-11 at 06:51 +0000, Jerin Jacob Kollanukkaran wrote:
> On Mon, 2019-02-04 at 07:18 +0000, Pallantla Poornima wrote:
> > 
> > %'16"PRIu64" %s "
> > diff --git a/drivers/event/opdl/opdl_evdev_xstats.c
> > b/drivers/event/opdl/opdl_evdev_xstats.c
> > index 0e6c6bd5e..27b3d8802 100644
> > --- a/drivers/event/opdl/opdl_evdev_xstats.c
> > +++ b/drivers/event/opdl/opdl_evdev_xstats.c
> > @@ -32,10 +32,9 @@ opdl_xstats_init(struct rte_eventdev *dev)
> >  			uint32_t index = (i * max_num_port_xstat) + j;
> >  
> >  			/* Name */
> > -			sprintf(device->port_xstat[index].stat.name,
> > -			       "port_%02u_%s",
> > -			       i,
> > -			       port_xstat_str[j]);
> > +			snprintf(device->port_xstat[index].stat.name,
> > +				sizeof(device-
> > > port_xstat[index].stat.name),
> 
> Same as above. Use RTE_EVENT_DEV_XSTATS_NAME_SIZE for size.

I overlooked the code. This code looks good to me.
If there is no comment for Liang Ma then i will merge this patch as is.



More information about the dev mailing list