bcachefs: Fix a valgrind conditional jump
authorKent Overstreet <kent.overstreet@gmail.com>
Tue, 17 Aug 2021 19:03:53 +0000 (15:03 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:09:10 +0000 (17:09 -0400)
Valgrind was complaining about a jump depending on uninitialized memory
- we weren't, but this change makes the code less confusing for valgrind
to follow.

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
fs/bcachefs/varint.c

index 6955ff5dc19ccfd6701bc93a05741716036dbaa4..e87da470c5812bae567fb3b6a25e6c4f2862d70a 100644 (file)
@@ -97,7 +97,7 @@ int bch2_varint_encode_fast(u8 *out, u64 v)
 int bch2_varint_decode_fast(const u8 *in, const u8 *end, u64 *out)
 {
        u64 v = get_unaligned_le64(in);
-       unsigned bytes = ffz(v & 255) + 1;
+       unsigned bytes = ffz(*in) + 1;
 
        if (unlikely(in + bytes > end))
                return -1;