diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2012-05-23 02:29:58 +0200 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2012-05-23 02:29:58 +0200 |
commit | a0a4f1c4f7d9d23d733cf3ae9685452364a58a70 (patch) | |
tree | 3726ea9c3492bb4fbf9352887ecdead612030840 | |
parent | de5f5e33f4be031d23477958808d09f9745d437f (diff) |
Fix bit shift validity
* ext2fs/balloc.c (ext2_new_block): When J & 31 is 31, replace 32bit right
shift with 0;
-rw-r--r-- | ext2fs/balloc.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/ext2fs/balloc.c b/ext2fs/balloc.c index 7333123c..8ad29cec 100644 --- a/ext2fs/balloc.c +++ b/ext2fs/balloc.c @@ -197,8 +197,11 @@ repeat: * The goal was occupied; search forward for a free * block within the next 32 blocks */ - lmap = ((((unsigned long *) bh)[j >> 5]) >> - ((j & 31) + 1)); + if (j & 31 == 31) + lmap = 0; + else + lmap = ((((unsigned long *) bh)[j >> 5]) >> + ((j & 31) + 1)); if (j < sblock->s_blocks_per_group - 32) lmap |= (((unsigned long *) bh)[(j >> 5) + 1]) << (31 - (j & 31)); |