> -----Original Message----- > From: Olivier MATZ [mailto:olivier.matz at 6wind.com] > Sent: Monday, June 30, 2014 12:42 AM > To: Richardson, Bruce; De Lara Guarch, Pablo; dev at dpdk.org > Subject: Re: [dpdk-dev] [PATCH] string: fix potential seg fault on snprintf > > Hello Bruce, > > On 06/27/2014 06:36 PM, Richardson, Bruce wrote: > > Famous last words include "that could never happen!" :-) > > Since this is not a performance critical piece of code, it does not hurt to > > leave > the Null-check in, and get the additional safety of checking for invalid > inputs. > > The "it does not hurt" should not be an argument to keep a patch. > If we follow your reasoning, we should also add tests of > RTE_LOG(..., NULL, ...), rte_eth_dev_*(NULL, ...), ... >
Actually, I see no issue with adding tests for all those cases. The only time I would agree with not testing all inputs for validity is in a performance critical code path. > In this particular case, giving a NULL argument is meaningless because > the semantic of the function is precisely to write something in the > buffer. Moreover, as I already said, this function is not called by the > user directly. > > Regards, > Olivier