attr: prevent garbage return value for NULL param

If nla is not given, then tmp is not set. Explicitly initalize with 0
to prevent garbage values. Found by Clang static analyzer.

Signed-off-by: Peter Wu <peter@lekensteyn.nl>
Signed-off-by: Thomas Haller <thaller@redhat.com>
This commit is contained in:
Peter Wu 2014-06-24 23:13:37 +02:00 committed by Thomas Haller
parent 2ca01afcee
commit 8e052f59f4

View file

@ -648,7 +648,7 @@ int nla_put_u64(struct nl_msg *msg, int attrtype, uint64_t value)
*/
uint64_t nla_get_u64(struct nlattr *nla)
{
uint64_t tmp;
uint64_t tmp = 0;
nla_memcpy(&tmp, nla, sizeof(tmp));