Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[SCSI] hpsa: check for dma_mapping_error in hpsa_passthru ioctls

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>

authored by

Stephen M. Cameron and committed by
James Bottomley
bcc48ffa c1f63c8f

+16
+16
drivers/scsi/hpsa.c
··· 3014 3014 if (iocommand.buf_size > 0) { 3015 3015 temp64.val = pci_map_single(h->pdev, buff, 3016 3016 iocommand.buf_size, PCI_DMA_BIDIRECTIONAL); 3017 + if (dma_mapping_error(&h->pdev->dev, temp64.val)) { 3018 + c->SG[0].Addr.lower = 0; 3019 + c->SG[0].Addr.upper = 0; 3020 + c->SG[0].Len = 0; 3021 + rc = -ENOMEM; 3022 + goto out; 3023 + } 3017 3024 c->SG[0].Addr.lower = temp64.val32.lower; 3018 3025 c->SG[0].Addr.upper = temp64.val32.upper; 3019 3026 c->SG[0].Len = iocommand.buf_size; ··· 3142 3135 for (i = 0; i < sg_used; i++) { 3143 3136 temp64.val = pci_map_single(h->pdev, buff[i], 3144 3137 buff_size[i], PCI_DMA_BIDIRECTIONAL); 3138 + if (dma_mapping_error(&h->pdev->dev, temp64.val)) { 3139 + c->SG[i].Addr.lower = 0; 3140 + c->SG[i].Addr.upper = 0; 3141 + c->SG[i].Len = 0; 3142 + hpsa_pci_unmap(h->pdev, c, i, 3143 + PCI_DMA_BIDIRECTIONAL); 3144 + status = -ENOMEM; 3145 + goto cleanup1; 3146 + } 3145 3147 c->SG[i].Addr.lower = temp64.val32.lower; 3146 3148 c->SG[i].Addr.upper = temp64.val32.upper; 3147 3149 c->SG[i].Len = buff_size[i];