From 2c0c5e6c21b31ca358e08d811c98b63d691c5005 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Mon, 4 Aug 2008 16:36:02 +0000 Subject: [PATCH] * Fixed a bug in scsi_periph that prevents accessing block number 0x100000. * The blocks beyond that would be potentially read in smaller chunks than anticipated, too. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26798 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/generic/scsi_periph/io.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/add-ons/kernel/generic/scsi_periph/io.c b/src/add-ons/kernel/generic/scsi_periph/io.c index 50c3f41173..c2bb9aaddf 100644 --- a/src/add-ons/kernel/generic/scsi_periph/io.c +++ b/src/add-ons/kernel/generic/scsi_periph/io.c @@ -82,7 +82,8 @@ periph_read_write(scsi_periph_handle_info *handle, const phys_vecs *vecs, // don't allow transfer cross the 24 bit address limit // (I'm not sure whether this is allowed, but this way we // are sure to not ask for trouble) - num_blocks = min(num_blocks, 0x100000 - pos); + if (pos < 0x100000) + num_blocks = min(num_blocks, 0x100000 - pos); } num_bytes = num_blocks * block_size; @@ -226,7 +227,7 @@ raw_command(scsi_periph_device_info *device, raw_device_command *cmd) request->flags = 0; - if (cmd->flags & B_RAW_DEVICE_DATA_IN) + if (cmd->flags & B_RAW_DEVICE_DATA_IN) request->flags |= SCSI_DIR_IN; else if (cmd->data_length) request->flags |= SCSI_DIR_OUT;