PERFORCE change 159562 for review
Hans Petter Selasky
hselasky at FreeBSD.org
Sat Mar 21 03:35:40 PDT 2009
http://perforce.freebsd.org/chv.cgi?CH=159562
Change 159562 by hselasky at hselasky_laptop001 on 2009/03/21 10:34:44
USB storage:
- Compile fix for 64-bit target.
Affected files ...
.. //depot/projects/usb/src/sys/dev/usb/storage/ustorage_fs.c#7 edit
Differences ...
==== //depot/projects/usb/src/sys/dev/usb/storage/ustorage_fs.c#7 (text+ko) ====
@@ -1583,6 +1583,7 @@
uint8_t error = 1;
uint8_t i;
uint32_t temp;
+ const uint32_t mask9 = (0xFFFFFFFFUL >> 9) << 9;
/* set default data transfer pointer */
sc->sc_transfer.data_ptr = sc->sc_qdata;
@@ -1686,7 +1687,7 @@
i = sc->sc_transfer.cmd_data[4];
sc->sc_transfer.cmd_dir = DIR_WRITE;
temp = ((i == 0) ? 256UL : i);
- error = ustorage_fs_min_len(sc, temp << 9, 0 - (1UL << 9));
+ error = ustorage_fs_min_len(sc, temp << 9, mask9);
if (error) {
break;
}
@@ -1702,7 +1703,7 @@
case SC_READ_10:
sc->sc_transfer.cmd_dir = DIR_WRITE;
temp = get_be16(&sc->sc_transfer.cmd_data[7]);
- error = ustorage_fs_min_len(sc, temp << 9, 0 - (1UL << 9));
+ error = ustorage_fs_min_len(sc, temp << 9, mask9);
if (error) {
break;
}
@@ -1724,7 +1725,7 @@
error = 1;
break;
}
- error = ustorage_fs_min_len(sc, temp << 9, 0 - (1UL << 9));
+ error = ustorage_fs_min_len(sc, temp << 9, mask9);
if (error) {
break;
}
@@ -1838,7 +1839,7 @@
i = sc->sc_transfer.cmd_data[4];
sc->sc_transfer.cmd_dir = DIR_READ;
temp = ((i == 0) ? 256UL : i);
- error = ustorage_fs_min_len(sc, temp << 9, 0 - (1UL << 9));
+ error = ustorage_fs_min_len(sc, temp << 9, mask9);
if (error) {
break;
}
@@ -1854,7 +1855,7 @@
case SC_WRITE_10:
sc->sc_transfer.cmd_dir = DIR_READ;
temp = get_be16(&sc->sc_transfer.cmd_data[7]);
- error = ustorage_fs_min_len(sc, temp << 9, 0 - (1UL << 9));
+ error = ustorage_fs_min_len(sc, temp << 9, mask9);
if (error) {
break;
}
@@ -1870,13 +1871,13 @@
case SC_WRITE_12:
sc->sc_transfer.cmd_dir = DIR_READ;
temp = get_be32(&sc->sc_transfer.cmd_data[6]);
- if (temp >= (1UL << (32 - 9))) {
+ if (temp > (mask9 >> 9)) {
/* numerical overflow */
sc->sc_csw.bCSWStatus = CSWSTATUS_FAILED;
error = 1;
break;
}
- error = ustorage_fs_min_len(sc, temp << 9, 0 - (1UL << 9));
+ error = ustorage_fs_min_len(sc, temp << 9, mask9);
if (error) {
break;
}
More information about the p4-projects
mailing list