Commit 97363c6a4f93a20380b4a9e11f35e27fed68a517
Committed by
Trond Myklebust
1 parent
9423a08ad5
Exists in
master
and in
39 other branches
sunrpc: xdr_xcode_hyper helpers cannot presume 64-bit alignment
Signed-off-by: Benny Halevy <bhalevy@panasas.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Showing 1 changed file with 3 additions and 2 deletions Side-by-side Diff
include/linux/sunrpc/xdr.h
... | ... | @@ -11,6 +11,7 @@ |
11 | 11 | |
12 | 12 | #include <linux/uio.h> |
13 | 13 | #include <asm/byteorder.h> |
14 | +#include <asm/unaligned.h> | |
14 | 15 | #include <linux/scatterlist.h> |
15 | 16 | |
16 | 17 | /* |
17 | 18 | |
... | ... | @@ -117,14 +118,14 @@ |
117 | 118 | static inline __be32 * |
118 | 119 | xdr_encode_hyper(__be32 *p, __u64 val) |
119 | 120 | { |
120 | - *(__be64 *)p = cpu_to_be64(val); | |
121 | + put_unaligned_be64(val, p); | |
121 | 122 | return p + 2; |
122 | 123 | } |
123 | 124 | |
124 | 125 | static inline __be32 * |
125 | 126 | xdr_decode_hyper(__be32 *p, __u64 *valp) |
126 | 127 | { |
127 | - *valp = be64_to_cpup((__be64 *)p); | |
128 | + *valp = get_unaligned_be64(p); | |
128 | 129 | return p + 2; |
129 | 130 | } |
130 | 131 |