summaryrefslogtreecommitdiff
path: root/libmachdev
diff options
context:
space:
mode:
authorZheng Da <zhengda1936@gmail.com>2010-08-08 08:08:36 +0200
committerZheng Da <zhengda1936@gmail.com>2010-08-08 08:08:36 +0200
commite30a817d6d2a1d71223caa238781a76104a54840 (patch)
treea41418fe03091ecbd4bd7de93cc0dfb2a7f21995 /libmachdev
parent3de13f2a911c402fc1275582d30b2f934cf433e5 (diff)
fix a bug in device_write for the block device.
Diffstat (limited to 'libmachdev')
-rw-r--r--libmachdev/block.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libmachdev/block.c b/libmachdev/block.c
index b239ecff..48fe6cd6 100644
--- a/libmachdev/block.c
+++ b/libmachdev/block.c
@@ -198,12 +198,12 @@ device_write (void *d, mach_port_t reply_port,
for (i = 0; i < npages; i++)
{
int size = PAGE_SIZE - ((int) data &~PAGE_MASK) > count ?
- PAGE_SIZE - ((int) data &~PAGE_MASK) : count;
+ count : PAGE_SIZE - ((int) data &~PAGE_MASK);
- err = block_dev_write (bd->dev, bn, data, count, write_done);
+ err = block_dev_write (bd->dev, bn, data, size, write_done);
if (err)
break;
- bn += count >> 9;
+ bn += size >> 9;
data += size;
count -= size;
writes++;