[dpdk-dev] [PATCH] string: fix potential seg fault on snprintf

Olivier MATZ olivier.matz at 6wind.com
Mon Jun 30 09:41:57 CEST 2014


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, ...), ...

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


More information about the dev mailing list