Message ID | 20121213220426.GM9713@sli.dy.fi |
---|---|
State | Accepted, archived |
Headers | show |
diff --git a/e2fsck/revoke.c b/e2fsck/revoke.c index 38c265e..dddef4d 100644 --- a/e2fsck/revoke.c +++ b/e2fsck/revoke.c @@ -115,7 +115,7 @@ static inline int hash(journal_t *journal, unsigned long block) return ((block << (hash_shift - 6)) ^ (block >> 13) ^ - (block << (hash_shift - 12))) & (table->hash_size - 1); + (block << (hash_shift - 10))) & (table->hash_size - 1); } static int insert_revoke_hash(journal_t *journal, unsigned long blocknr,
There's a shift by (hash_shift - 12) in hash(), but hash() is called with hash_shift=10, resulting in a negative shift and thus undefined behavior. A simple and stupid minimal fix is to just change the subtracted amount to 10. Caught by clang -fsanitize=undefined. Signed-off-by: Sami Liedes <sami.liedes@iki.fi> --- e2fsck/revoke.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)