Skip to content

Commit 3508f31

Browse files
committed
Merge tag 'for-6.9/dm-fixes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm
Pull device mapper fixes from Mike Snitzer: - Fix MAINTAINERS to not include M: dm-devel for DM entries. - Fix DM vdo's murmurhash to use proper byteswapping methods. - Fix DM integrity clang warning about comparison out-of-range. * tag 'for-6.9/dm-fixes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm: dm integrity: fix out-of-range warning dm vdo murmurhash3: use kernel byteswapping routines instead of GCC ones MAINTAINERS: Remove incorrect M: tag for [email protected]
2 parents 033e449 + 8e91c23 commit 3508f31

File tree

3 files changed

+9
-27
lines changed

3 files changed

+9
-27
lines changed

MAINTAINERS

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6156,7 +6156,6 @@ DEVICE-MAPPER (LVM)
61566156
M: Alasdair Kergon <[email protected]>
61576157
M: Mike Snitzer <[email protected]>
61586158
M: Mikulas Patocka <[email protected]>
6159-
61606159
61616160
S: Maintained
61626161
Q: http://patchwork.kernel.org/project/dm-devel/list/

drivers/md/dm-integrity.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4221,7 +4221,7 @@ static int dm_integrity_ctr(struct dm_target *ti, unsigned int argc, char **argv
42214221
} else if (sscanf(opt_string, "sectors_per_bit:%llu%c", &llval, &dummy) == 1) {
42224222
log2_sectors_per_bitmap_bit = !llval ? 0 : __ilog2_u64(llval);
42234223
} else if (sscanf(opt_string, "bitmap_flush_interval:%u%c", &val, &dummy) == 1) {
4224-
if (val >= (uint64_t)UINT_MAX * 1000 / HZ) {
4224+
if ((uint64_t)val >= (uint64_t)UINT_MAX * 1000 / HZ) {
42254225
r = -EINVAL;
42264226
ti->error = "Invalid bitmap_flush_interval argument";
42274227
goto bad;

drivers/md/dm-vdo/murmurhash3.c

Lines changed: 8 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -8,33 +8,14 @@
88

99
#include "murmurhash3.h"
1010

11+
#include <asm/unaligned.h>
12+
1113
static inline u64 rotl64(u64 x, s8 r)
1214
{
1315
return (x << r) | (x >> (64 - r));
1416
}
1517

1618
#define ROTL64(x, y) rotl64(x, y)
17-
static __always_inline u64 getblock64(const u64 *p, int i)
18-
{
19-
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
20-
return p[i];
21-
#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
22-
return __builtin_bswap64(p[i]);
23-
#else
24-
#error "can't figure out byte order"
25-
#endif
26-
}
27-
28-
static __always_inline void putblock64(u64 *p, int i, u64 value)
29-
{
30-
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
31-
p[i] = value;
32-
#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
33-
p[i] = __builtin_bswap64(value);
34-
#else
35-
#error "can't figure out byte order"
36-
#endif
37-
}
3819

3920
/* Finalization mix - force all bits of a hash block to avalanche */
4021

@@ -60,15 +41,17 @@ void murmurhash3_128(const void *key, const int len, const u32 seed, void *out)
6041
const u64 c1 = 0x87c37b91114253d5LLU;
6142
const u64 c2 = 0x4cf5ad432745937fLLU;
6243

44+
u64 *hash_out = out;
45+
6346
/* body */
6447

6548
const u64 *blocks = (const u64 *)(data);
6649

6750
int i;
6851

6952
for (i = 0; i < nblocks; i++) {
70-
u64 k1 = getblock64(blocks, i * 2 + 0);
71-
u64 k2 = getblock64(blocks, i * 2 + 1);
53+
u64 k1 = get_unaligned_le64(&blocks[i * 2]);
54+
u64 k2 = get_unaligned_le64(&blocks[i * 2 + 1]);
7255

7356
k1 *= c1;
7457
k1 = ROTL64(k1, 31);
@@ -170,6 +153,6 @@ void murmurhash3_128(const void *key, const int len, const u32 seed, void *out)
170153
h1 += h2;
171154
h2 += h1;
172155

173-
putblock64((u64 *)out, 0, h1);
174-
putblock64((u64 *)out, 1, h2);
156+
put_unaligned_le64(h1, &hash_out[0]);
157+
put_unaligned_le64(h2, &hash_out[1]);
175158
}

0 commit comments

Comments
 (0)