[dpdk-dev] [PATCH] app/testbbdev: fix sprintf with snprintf

Mokhtar, Amr amr.mokhtar at intel.com
Fri Feb 15 12:30:05 CET 2019


> -----Original Message-----
> From: Parthasarathy, JananeeX M
> Sent: Friday 15 February 2019 11:08
> To: Yigit, Ferruh <ferruh.yigit at intel.com>; Poornima, PallantlaX
> <pallantlax.poornima at intel.com>; dev at dpdk.org
> Cc: Pattan, Reshma <reshma.pattan at intel.com>; Mokhtar, Amr
> <amr.mokhtar at intel.com>; stable at dpdk.org
> Subject: RE: [dpdk-dev] [PATCH] app/testbbdev: fix sprintf with snprintf
> 
> Hi
> 
> >-----Original Message-----
> >From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Ferruh Yigit
> >Sent: Friday, February 08, 2019 7:44 PM
> >To: Poornima, PallantlaX <pallantlax.poornima at intel.com>;
> dev at dpdk.org
> >Cc: Pattan, Reshma <reshma.pattan at intel.com>; Mokhtar, Amr
> ><amr.mokhtar at intel.com>; stable at dpdk.org
> >Subject: Re: [dpdk-dev] [PATCH] app/testbbdev: fix sprintf with snprintf
> >
> >On 2/4/2019 7:15 AM, Pallantla Poornima wrote:
> >> @@ -825,7 +825,7 @@
> >>
> >>  test_bbdev_driver_init(void)
> >>
> >> TEST_ASSERT_FAIL(rte_bbdev_release(NULL),
> >> "Failed to uninitialize bbdev driver with NULL bbdev");
> >> - sprintf(name_tmp, "%s", "invalid_name");
> >> + snprintf(name_tmp, sizeof(name_tmp), "%s", "invalid_name");
> >> dev2 = rte_bbdev_get_named_dev(name_tmp);
> >> TEST_ASSERT_FAIL(rte_bbdev_release(dev2),
> >> "Failed to uninitialize bbdev driver with invalid name");
> >
> >Can use strlcpy() instead of snprintf() here.
> 
> Please confirm whether we can do this change (snprintf to strlcpy) as there
> was Ack from other reviewer.

I agree with Ferruh suggestion, as this is a simple string copying.
Feel free to use strlcpy instead and retain my Ack.
Thanks.

> Thanks
> M.P.Jananee


More information about the dev mailing list