]> git.ipfire.org Git - thirdparty/libnl.git/commitdiff
attr: prevent garbage return value for NULL param
authorPeter Wu <peter@lekensteyn.nl>
Tue, 24 Jun 2014 21:13:37 +0000 (23:13 +0200)
committerThomas Haller <thaller@redhat.com>
Wed, 25 Jun 2014 07:16:49 +0000 (09:16 +0200)
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>
lib/attr.c

index 66c029c9239196f032f7d081b1e779e0bff2c5df..d3de3993b823362a1a742148dec423d1f9a79c4d 100644 (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));