From 8e052f59f431844ff6576dcf7b47293ab4ef45aa Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Tue, 24 Jun 2014 23:13:37 +0200 Subject: 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 Signed-off-by: Thomas Haller --- lib/attr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/attr.c') diff --git a/lib/attr.c b/lib/attr.c index 66c029c9..d3de3993 100644 --- a/lib/attr.c +++ b/lib/attr.c @@ -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)); -- cgit v1.2.3