From: Albert Lee <albertcc@tw.ibm.com>
To: Jeff Garzik <jgarzik@pobox.com>
Cc: IDE Linux <linux-ide@vger.kernel.org>
Subject: [PATCH 1/3] libata "if condition" enhancement
Date: Mon, 01 Aug 2005 22:57:50 +0800 [thread overview]
Message-ID: <42EE386E.604@tw.ibm.com> (raw)
In-Reply-To: <42EE37AB.2000006@tw.ibm.com>
[-- Attachment #1: Type: text/plain, Size: 407 bytes --]
Jeff,
PATCH 1/3: "if condition" enhancement.
Changes:
Modify __atapi_pio_bytes() to make the "if condition"
more robust, in case of something like (bytes > qc->nbytes), (qc->cursg_ofs > sg->length) or
(count > bytes) happens.
Those conditions won't happen in the current libata code. Just to be safe (paranoid).
For your review, thanks.
Albert
Signed-off-by: Albert Lee <albertcc@tw.ibm.com>
[-- Attachment #2: pio1.diff --]
[-- Type: text/plain, Size: 732 bytes --]
--- linux/drivers/scsi/libata-core.c 2005-08-01 15:35:17.000000000 +0800
+++ 01_pio_ifcond/drivers/scsi/libata-core.c 2005-08-01 15:52:29.000000000 +0800
@@ -2603,7 +2603,7 @@
unsigned char *buf;
unsigned int offset, count;
- if (qc->curbytes == qc->nbytes - bytes)
+ if (qc->curbytes + bytes >= qc->nbytes)
ap->pio_task_state = PIO_ST_LAST;
next_sg:
@@ -2624,11 +2624,10 @@
buf = kmap(page) + offset;
- bytes -= count;
qc->curbytes += count;
qc->cursg_ofs += count;
- if (qc->cursg_ofs == sg->length) {
+ if (qc->cursg_ofs >= sg->length) {
qc->cursg++;
qc->cursg_ofs = 0;
}
@@ -2640,7 +2639,9 @@
kunmap(page);
- if (bytes) {
+ if (bytes > count) {
+ bytes -= count;
+
goto next_sg;
}
}
next prev parent reply other threads:[~2005-08-01 14:58 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-08-01 14:54 [PATCH 0/3] libata PIO fixes (revised) Albert Lee
2005-08-01 14:57 ` Albert Lee [this message]
2005-08-01 15:00 ` [PATCH 2/3] libata ata_data_xfer() fix Albert Lee
2005-08-01 18:36 ` Jeff Garzik
2005-08-01 15:03 ` [PATCH 3/3] libata handle the case when device returns/needs extra data Albert Lee
2005-08-01 18:37 ` Jeff Garzik
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=42EE386E.604@tw.ibm.com \
--to=albertcc@tw.ibm.com \
--cc=jgarzik@pobox.com \
--cc=linux-ide@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).