u32: prevent memcpy from NULL

Found by Clang static analyzer.

Fixes: 6cdc32df831a273007af7d24a3f75cd06e0ae738
Signed-off-by: Peter Wu <peter@lekensteyn.nl>
Signed-off-by: Thomas Haller <thaller@redhat.com>
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>
attr: fix compile warning in headers

strlen() returns a size_t type, but nla_put accepts an int only. This
breaks a -Werror build of applications using libnl, so avoid this
warning by explicitly casting the length to an int.

Signed-off-by: Peter Wu <peter@lekensteyn.nl>
Signed-off-by: Thomas Haller <thaller@redhat.com>
Merge branch 'coverity-fixes-2'

http://lists.infradead.org/pipermail/libnl/2014-June/001507.html

Signed-off-by: Thomas Haller <thaller@redhat.com>