diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2023-02-15 18:17:33 +0100 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2023-02-15 18:18:08 +0100 |
commit | f6c29f62283b05ca12bc032870b5e69bd50d82ba (patch) | |
tree | 6c7f2633466d77838503824d6db577f9ce3a0bb4 /defpager | |
parent | 56d065041793509a6f60671f6ae3400698bd5639 (diff) | |
download | hurd-f6c29f62283b05ca12bc032870b5e69bd50d82ba.tar.gz hurd-f6c29f62283b05ca12bc032870b5e69bd50d82ba.tar.bz2 hurd-f6c29f62283b05ca12bc032870b5e69bd50d82ba.zip |
Fix accessing bit 31
Shifting (signed) 1 to left 31 positions is undefined behavior. So make
this an unsigned so it becomes defined behavior.
Diffstat (limited to 'defpager')
-rw-r--r-- | defpager/backing.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/defpager/backing.c b/defpager/backing.c index aa9810c0..56fe6551 100644 --- a/defpager/backing.c +++ b/defpager/backing.c @@ -96,7 +96,7 @@ allocate_backing_page () bit--; /* Mark it */ - *bmap_rotor |= 1 << bit; + *bmap_rotor |= 1U << bit; /* Return the correct offset */ pfn = (bmap_rotor - bmap) * 8 + bit; @@ -123,7 +123,7 @@ return_backing_pages (off_t *map, int maplen) b = bmap + pfn & ~7; bit = pfn & 7; - assert_backtrace ((*b & (1 << bit)) == 0); + assert_backtrace ((*b & (1U << bit)) == 0); *b |= 1 << bit; } pthread_mutex_unlock (&bmap_lock); |