mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 14:11:52 +00:00
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>
This commit is contained in:
parent
2e118ba36d
commit
ee1b8dc17a
@ -85,7 +85,7 @@ int bch2_varint_encode_fast(u8 *out, u64 v)
|
|||||||
|
|
||||||
if (likely(bytes < 9)) {
|
if (likely(bytes < 9)) {
|
||||||
v <<= bytes;
|
v <<= bytes;
|
||||||
v |= ~(~0 << (bytes - 1));
|
v |= ~(~0U << (bytes - 1));
|
||||||
} else {
|
} else {
|
||||||
*out++ = 255;
|
*out++ = 255;
|
||||||
bytes = 9;
|
bytes = 9;
|
||||||
|
Loading…
Reference in New Issue
Block a user