Skip to content

Commit ee1b8dc

Browse files
tavianatorKent Overstreet
authored andcommitted
bcachefs: varint: Avoid left-shift of a negative value
Shifting a negative value left is undefined. Signed-off-by: Tavian Barnes <[email protected]> Signed-off-by: Kent Overstreet <[email protected]>
1 parent 2e118ba commit ee1b8dc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/bcachefs/varint.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ int bch2_varint_encode_fast(u8 *out, u64 v)
8585

8686
if (likely(bytes < 9)) {
8787
v <<= bytes;
88-
v |= ~(~0 << (bytes - 1));
88+
v |= ~(~0U << (bytes - 1));
8989
} else {
9090
*out++ = 255;
9191
bytes = 9;

0 commit comments

Comments
 (0)