projects
/
linux-block.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
2e118ba
)
bcachefs: varint: Avoid left-shift of a negative value
author
Tavian Barnes
<tavianator@tavianator.com>
Fri, 21 Jun 2024 20:39:58 +0000
(16:39 -0400)
committer
Kent Overstreet
<kent.overstreet@linux.dev>
Thu, 18 Jul 2024 22:33:30 +0000
(18:33 -0400)
Shifting a negative value left is undefined.
Signed-off-by: Tavian Barnes <tavianator@tavianator.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/varint.c
patch
|
blob
|
blame
|
history
diff --git
a/fs/bcachefs/varint.c
b/fs/bcachefs/varint.c
index cb4f33ed9ab374fbd50bbf74419335564f55df9a..a9ebcd82c60254080c077d7fc4b907fb6634a424 100644
(file)
--- 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 |= ~(~0
U
<< (bytes - 1));
} else {
*out++ = 255;
bytes = 9;