devargs: fix crash on failure
authorStephen Hemminger <stephen@networkplumber.org>
Fri, 15 May 2015 16:37:40 +0000 (09:37 -0700)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Mon, 20 Jul 2015 01:01:10 +0000 (03:01 +0200)
commitfc2d48890033d713bddb19bcebd2f903d14f5ab1
treeaa3bab196e6c6f1f43e44acfaabeb71acb671612
parentfa8cc60774a7167823f63997ab669b7f39c11af4
devargs: fix crash on failure

This problem was discovered when passing invalid PCI id to the
blacklist API in devargs.

Any failures in rte_devargs_add would cause a core dump because
it would call rte_log() before the the EAL log environment was
initialized.  Rather than try and log just remove the messages
and leave it up to the caller to check the return value.

Most of the other failure possibilities are when malloc() fails, and if
that happens any logging that used malloc() would also fail.

This failure was not caught by the standalone tests to devargs
because the tests are run after calling rte_eal_init (which is not
how devargs is intended to be used).

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
lib/librte_eal/common/eal_common_devargs.c