diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-07 20:30:44 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-07 20:30:44 -0500 |
commit | c8b6de16d9434405e5832b8772e4f986ddd5118e (patch) | |
tree | 03d5d92be22e83778e3cf1367f8b6847eb953eb6 /drivers/scsi/sd.c | |
parent | a6a852e93705121e2b90bd41ad50e85a508699aa (diff) | |
parent | 8e31e607ea050c0df1483d8b6cdd5b1395c03cbe (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6: (48 commits)
[SCSI] aacraid: do not set valid bit in sense information
[SCSI] ses: add new Enclosure ULD
[SCSI] enclosure: add support for enclosure services
[SCSI] sr: fix test unit ready responses
[SCSI] u14-34f: fix data direction bug
[SCSI] aacraid: pci_set_dma_max_seg_size opened up for late model controllers
[SCSI] fix BUG when sum(scatterlist) > bufflen
[SCSI] arcmsr: updates (1.20.00.15)
[SCSI] advansys: make 3 functions static
[SCSI] Small cleanups for scsi_host.h
[SCSI] dc395x: fix uninitialized var warning
[SCSI] NCR53C9x: remove driver
[SCSI] remove m68k NCR53C9x based drivers
[SCSI] dec_esp: Remove driver
[SCSI] kernel-doc: fix scsi docbook
[SCSI] update my email address
[SCSI] add protocol definitions
[SCSI] sd: handle bad lba in sense information
[SCSI] qla2xxx: Update version number to 8.02.00-k8.
[SCSI] qla2xxx: Correct issue where incorrect init-fw mailbox command was used on non-NPIV capable ISPs.
...
Diffstat (limited to 'drivers/scsi/sd.c')
-rw-r--r-- | drivers/scsi/sd.c | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 51a5557f42dd..37df8bbe7f46 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c | |||
@@ -929,6 +929,7 @@ static int sd_done(struct scsi_cmnd *SCpnt) | |||
929 | unsigned int xfer_size = scsi_bufflen(SCpnt); | 929 | unsigned int xfer_size = scsi_bufflen(SCpnt); |
930 | unsigned int good_bytes = result ? 0 : xfer_size; | 930 | unsigned int good_bytes = result ? 0 : xfer_size; |
931 | u64 start_lba = SCpnt->request->sector; | 931 | u64 start_lba = SCpnt->request->sector; |
932 | u64 end_lba = SCpnt->request->sector + (xfer_size / 512); | ||
932 | u64 bad_lba; | 933 | u64 bad_lba; |
933 | struct scsi_sense_hdr sshdr; | 934 | struct scsi_sense_hdr sshdr; |
934 | int sense_valid = 0; | 935 | int sense_valid = 0; |
@@ -967,26 +968,23 @@ static int sd_done(struct scsi_cmnd *SCpnt) | |||
967 | goto out; | 968 | goto out; |
968 | if (xfer_size <= SCpnt->device->sector_size) | 969 | if (xfer_size <= SCpnt->device->sector_size) |
969 | goto out; | 970 | goto out; |
970 | switch (SCpnt->device->sector_size) { | 971 | if (SCpnt->device->sector_size < 512) { |
971 | case 256: | 972 | /* only legitimate sector_size here is 256 */ |
972 | start_lba <<= 1; | 973 | start_lba <<= 1; |
973 | break; | 974 | end_lba <<= 1; |
974 | case 512: | 975 | } else { |
975 | break; | 976 | /* be careful ... don't want any overflows */ |
976 | case 1024: | 977 | u64 factor = SCpnt->device->sector_size / 512; |
977 | start_lba >>= 1; | 978 | do_div(start_lba, factor); |
978 | break; | 979 | do_div(end_lba, factor); |
979 | case 2048: | ||
980 | start_lba >>= 2; | ||
981 | break; | ||
982 | case 4096: | ||
983 | start_lba >>= 3; | ||
984 | break; | ||
985 | default: | ||
986 | /* Print something here with limiting frequency. */ | ||
987 | goto out; | ||
988 | break; | ||
989 | } | 980 | } |
981 | |||
982 | if (bad_lba < start_lba || bad_lba >= end_lba) | ||
983 | /* the bad lba was reported incorrectly, we have | ||
984 | * no idea where the error is | ||
985 | */ | ||
986 | goto out; | ||
987 | |||
990 | /* This computation should always be done in terms of | 988 | /* This computation should always be done in terms of |
991 | * the resolution of the device's medium. | 989 | * the resolution of the device's medium. |
992 | */ | 990 | */ |