aboutsummaryrefslogtreecommitdiff
path: root/sys/geom/raid
diff options
context:
space:
mode:
authorEitan Adler <eadler@FreeBSD.org>2013-11-30 22:17:27 +0000
committerEitan Adler <eadler@FreeBSD.org>2013-11-30 22:17:27 +0000
commit7a22215c5346c9009d1dfa4d3c118ff99f89d184 (patch)
tree050fb3b68519f6ef7d59051550fa29cdd79d6dac /sys/geom/raid
parentc8aef31d309ac3f874c461619248fee9c1d74c2f (diff)
downloadsrc-7a22215c5346c9009d1dfa4d3c118ff99f89d184.tar.gz
src-7a22215c5346c9009d1dfa4d3c118ff99f89d184.zip
Fix undefined behavior: (1 << 31) is not defined as 1 is an int and this
shifts into the sign bit. Instead use (1U << 31) which gets the expected result. This fix is not ideal as it assumes a 32 bit int, but does fix the issue for most cases. A similar change was made in OpenBSD. Discussed with: -arch, rdivacky Reviewed by: cperciva
Notes
Notes: svn path=/head/; revision=258780
Diffstat (limited to 'sys/geom/raid')
-rw-r--r--sys/geom/raid/tr_raid1e.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/geom/raid/tr_raid1e.c b/sys/geom/raid/tr_raid1e.c
index d283606b59c5..404b9e609344 100644
--- a/sys/geom/raid/tr_raid1e.c
+++ b/sys/geom/raid/tr_raid1e.c
@@ -1051,7 +1051,7 @@ rebuild_round_done:
nsd->sd_pos);
if (do_write)
mask |= 1 << 31;
- if ((mask & (1 << 31)) != 0)
+ if ((mask & (1U << 31)) != 0)
sd->sd_recovery++;
cbp->bio_caller2 = (void *)mask;
if (do_write) {
@@ -1074,7 +1074,7 @@ rebuild_round_done:
}
if (bp->bio_cmd == BIO_READ &&
bp->bio_error == 0 &&
- (mask & (1 << 31)) != 0) {
+ (mask & (1U << 31)) != 0) {
G_RAID_LOGREQ(3, bp, "Recovered data from other drive");
/* Restore what we were doing. */
@@ -1101,7 +1101,7 @@ rebuild_round_done:
return;
}
}
- if ((mask & (1 << 31)) != 0) {
+ if ((mask & (1U << 31)) != 0) {
/*
* We're done with a recovery, mark the range as unlocked.
* For any write errors, we agressively fail the disk since