diff options
author | Tavian Barnes | 2024-06-21 16:39:58 -0400 |
---|---|---|
committer | Kent Overstreet | 2024-07-18 18:33:30 -0400 |
commit | ee1b8dc17ac367f3fbea18fee4f7825eb11eb757 (patch) | |
tree | 76e0ab5a5c016bea4ac70671da9a5c4fc80d6ab1 /fs/bcachefs | |
parent | 2e118ba36d56acf78084518dfb7cb53b1d417da0 (diff) |
bcachefs: varint: Avoid left-shift of a negative value
Shifting a negative value left is undefined.
Signed-off-by: Tavian Barnes <tavianator@tavianator.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs')
-rw-r--r-- | fs/bcachefs/varint.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/bcachefs/varint.c b/fs/bcachefs/varint.c index cb4f33ed9ab3..a9ebcd82c602 100644 --- a/fs/bcachefs/varint.c +++ b/fs/bcachefs/varint.c @@ -85,7 +85,7 @@ int bch2_varint_encode_fast(u8 *out, u64 v) if (likely(bytes < 9)) { v <<= bytes; - v |= ~(~0 << (bytes - 1)); + v |= ~(~0U << (bytes - 1)); } else { *out++ = 255; bytes = 9; |