netlink: fix unaligned access in nla_get_be64()
authorPablo Neira Ayuso <pablo@netfilter.org>
Tue, 16 Mar 2010 13:30:44 +0000 (13:30 +0000)
committerDavid S. Miller <davem@davemloft.net>
Sat, 20 Mar 2010 05:47:23 +0000 (22:47 -0700)
This patch fixes a unaligned access in nla_get_be64() that was
introduced by myself in a17c859849402315613a0015ac8fbf101acf0cc1.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/netlink.h

index f82e463c875a51600ad0055c86c164d12e3e16ed..4fc05b58503eb4beab8fc20b3ab0b762f9f3d293 100644 (file)
@@ -945,7 +945,11 @@ static inline u64 nla_get_u64(const struct nlattr *nla)
  */
 static inline __be64 nla_get_be64(const struct nlattr *nla)
 {
-       return *(__be64 *) nla_data(nla);
+       __be64 tmp;
+
+       nla_memcpy(&tmp, nla, sizeof(tmp));
+
+       return tmp;
 }
 
 /**