diff options
-rw-r--r-- | drivers/infiniband/core/packer.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/infiniband/core/packer.c b/drivers/infiniband/core/packer.c index 5f15feffeae2..eb5ff54c10d7 100644 --- a/drivers/infiniband/core/packer.c +++ b/drivers/infiniband/core/packer.c | |||
@@ -96,7 +96,7 @@ void ib_pack(const struct ib_field *desc, | |||
96 | else | 96 | else |
97 | val = 0; | 97 | val = 0; |
98 | 98 | ||
99 | mask = cpu_to_be64(((1ull << desc[i].size_bits) - 1) << shift); | 99 | mask = cpu_to_be64((~0ull >> (64 - desc[i].size_bits)) << shift); |
100 | addr = (__be64 *) ((__be32 *) buf + desc[i].offset_words); | 100 | addr = (__be64 *) ((__be32 *) buf + desc[i].offset_words); |
101 | *addr = (*addr & ~mask) | (cpu_to_be64(val) & mask); | 101 | *addr = (*addr & ~mask) | (cpu_to_be64(val) & mask); |
102 | } else { | 102 | } else { |
@@ -176,7 +176,7 @@ void ib_unpack(const struct ib_field *desc, | |||
176 | __be64 *addr; | 176 | __be64 *addr; |
177 | 177 | ||
178 | shift = 64 - desc[i].offset_bits - desc[i].size_bits; | 178 | shift = 64 - desc[i].offset_bits - desc[i].size_bits; |
179 | mask = ((1ull << desc[i].size_bits) - 1) << shift; | 179 | mask = (~0ull >> (64 - desc[i].size_bits)) << shift; |
180 | addr = (__be64 *) buf + desc[i].offset_words; | 180 | addr = (__be64 *) buf + desc[i].offset_words; |
181 | val = (be64_to_cpup(addr) & mask) >> shift; | 181 | val = (be64_to_cpup(addr) & mask) >> shift; |
182 | value_write(desc[i].struct_offset_bytes, | 182 | value_write(desc[i].struct_offset_bytes, |