aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/mpt
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/dev/mpt
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/dev/mpt')
-rw-r--r--sys/dev/mpt/mpt_cam.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/dev/mpt/mpt_cam.c b/sys/dev/mpt/mpt_cam.c
index c9b27d6a6204..8feffbbe76fb 100644
--- a/sys/dev/mpt/mpt_cam.c
+++ b/sys/dev/mpt/mpt_cam.c
@@ -1431,7 +1431,7 @@ bad:
/* SAS1078 36GB limitation WAR */
if (mpt->is_1078 && (((uint64_t)dm_segs->ds_addr +
MPI_SGE_LENGTH(se->FlagsLength)) >> 32) == 9) {
- addr |= (1 << 31);
+ addr |= (1U << 31);
tf |= MPI_SGE_FLAGS_LOCAL_ADDRESS;
}
se->Address.High = htole32(addr);
@@ -1554,7 +1554,7 @@ bad:
(((uint64_t)dm_segs->ds_addr +
MPI_SGE_LENGTH(se->FlagsLength)) >>
32) == 9) {
- addr |= (1 << 31);
+ addr |= (1U << 31);
tf |= MPI_SGE_FLAGS_LOCAL_ADDRESS;
}
se->Address.High = htole32(addr);