From: Ming Lei <ming.lei@redhat.com>
To: linux-scsi@vger.kernel.org,
"Martin K . Petersen" <martin.petersen@oracle.com>
Cc: Michael Schmitz <schmitzmic@gmail.com>,
devel@driverdev.osuosl.org, Hannes Reinecke <hare@suse.com>,
Bart Van Assche <bvanassche@acm.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
James Smart <james.smart@broadcom.com>,
"Ewan D . Milne" <emilne@redhat.com>, Jim Gill <jgill@vmware.com>,
James Bottomley <James.Bottomley@HansenPartnership.com>,
Brian King <brking@us.ibm.com>,
Finn Thain <fthain@telegraphics.com.au>,
"Juergen E . Fischer" <fischer@norbit.de>,
Ming Lei <ming.lei@redhat.com>, Christoph Hellwig <hch@lst.de>
Subject: [PATCH V2 08/15] staging: unisys: visorhba: use sg helper to operate sgl
Date: Thu, 13 Jun 2019 15:13:28 +0800 [thread overview]
Message-ID: <20190613071335.5679-9-ming.lei@redhat.com> (raw)
In-Reply-To: <20190613071335.5679-1-ming.lei@redhat.com>
The current way isn't safe for chained sgl, so use sg helper to
operate sgl.
Cc: devel@driverdev.osuosl.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
---
drivers/staging/unisys/visorhba/visorhba_main.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/staging/unisys/visorhba/visorhba_main.c b/drivers/staging/unisys/visorhba/visorhba_main.c
index 2dad36a05518..dd979ee4dcf1 100644
--- a/drivers/staging/unisys/visorhba/visorhba_main.c
+++ b/drivers/staging/unisys/visorhba/visorhba_main.c
@@ -871,12 +871,11 @@ static void do_scsi_nolinuxstat(struct uiscmdrsp *cmdrsp,
return;
}
- sg = scsi_sglist(scsicmd);
- for (i = 0; i < scsi_sg_count(scsicmd); i++) {
- this_page_orig = kmap_atomic(sg_page(sg + i));
+ scsi_for_each_sg(scsicmd, sg, scsi_sg_count(scsicmd), i) {
+ this_page_orig = kmap_atomic(sg_page(sg));
this_page = (void *)((unsigned long)this_page_orig |
- sg[i].offset);
- memcpy(this_page, buf + bufind, sg[i].length);
+ sg->offset);
+ memcpy(this_page, buf + bufind, sg->length);
kunmap_atomic(this_page_orig);
}
kfree(buf);
--
2.20.1
next parent reply other threads:[~2019-06-13 7:13 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20190613071335.5679-1-ming.lei@redhat.com>
2019-06-13 7:13 ` Ming Lei [this message]
2019-06-13 9:52 ` [PATCH V2 08/15] staging: unisys: visorhba: use sg helper to operate sgl Greg Kroah-Hartman
2019-06-13 10:04 ` Ming Lei
2019-06-13 10:16 ` Greg Kroah-Hartman
2019-06-13 15:46 ` James Bottomley
2019-06-13 10:24 ` Dan Carpenter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190613071335.5679-9-ming.lei@redhat.com \
--to=ming.lei@redhat.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=brking@us.ibm.com \
--cc=bvanassche@acm.org \
--cc=devel@driverdev.osuosl.org \
--cc=emilne@redhat.com \
--cc=fischer@norbit.de \
--cc=fthain@telegraphics.com.au \
--cc=gregkh@linuxfoundation.org \
--cc=hare@suse.com \
--cc=hch@lst.de \
--cc=james.smart@broadcom.com \
--cc=jgill@vmware.com \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=schmitzmic@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox