Commit bb789d01620e5d36081b22edb6fb71cf55ff043c
Committed by
James Bottomley
1 parent
c4de0cebc5
Exists in
master
and in
7 other branches
[SCSI] mpt2sas: fix the incorrect scsi_dma_map error checking
scsi_dma_map() returns -1 if an error occurred (zero means that the command has no data). So the following current code can't catch an error: sges_left = scsi_dma_map(scmd); if (!sges_left) { sdev_printk(KERN_ERR, scmd->device, "pci_map_sg" " failed: request for %d bytes!\n", scsi_bufflen(scmd)); return -ENOMEM; } Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Acked-by: "Desai, Kashyap" <Kashyap.Desai@lsi.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Showing 1 changed file with 2 additions and 2 deletions Side-by-side Diff
drivers/scsi/mpt2sas/mpt2sas_scsih.c
... | ... | @@ -988,7 +988,7 @@ |
988 | 988 | u32 chain_offset; |
989 | 989 | u32 chain_length; |
990 | 990 | u32 chain_flags; |
991 | - u32 sges_left; | |
991 | + int sges_left; | |
992 | 992 | u32 sges_in_segment; |
993 | 993 | u32 sgl_flags; |
994 | 994 | u32 sgl_flags_last_element; |
... | ... | @@ -1009,7 +1009,7 @@ |
1009 | 1009 | |
1010 | 1010 | sg_scmd = scsi_sglist(scmd); |
1011 | 1011 | sges_left = scsi_dma_map(scmd); |
1012 | - if (!sges_left) { | |
1012 | + if (sges_left < 0) { | |
1013 | 1013 | sdev_printk(KERN_ERR, scmd->device, "pci_map_sg" |
1014 | 1014 | " failed: request for %d bytes!\n", scsi_bufflen(scmd)); |
1015 | 1015 | return -ENOMEM; |