Looks good, Reviewed-by: Christoph Hellwig <hch@xxxxxx> > @@ -381,16 +382,18 @@ static void esp_map_dma(struct esp *esp, struct scsi_cmnd *cmd) > * a dma address, so perform an identity mapping. > */ > spriv->num_sg = scsi_sg_count(cmd); > - for (i = 0; i < spriv->num_sg; i++) { > - sg[i].dma_address = (uintptr_t)sg_virt(&sg[i]); > - total += sg_dma_len(&sg[i]); > + > + scsi_for_each_sg(cmd, s, spriv->num_sg, i) { > + s->dma_address = (uintptr_t)sg_virt(s); > + total += sg_dma_len(s); But I wonder if we could just use blk_rq_bytes() here, maybe through a new scsi inline wrappers, instead of iterating over all SGs. Maybe for next merge window and not the bug fix..