summaryrefslogtreecommitdiffstats
path: root/sys/dev
diff options
context:
space:
mode:
authorsos <sos@FreeBSD.org>2000-08-13 09:08:19 +0000
committersos <sos@FreeBSD.org>2000-08-13 09:08:19 +0000
commita6430b961c695c800f6e708c4b9f774b4e92978f (patch)
tree2b8c865cb51d92fd1441c06d5cd2aa76d5c1fea0 /sys/dev
parent985942e1cb0042997b0299f7f514a25d57c3ff19 (diff)
downloadFreeBSD-src-a6430b961c695c800f6e708c4b9f774b4e92978f.zip
FreeBSD-src-a6430b961c695c800f6e708c4b9f774b4e92978f.tar.gz
Fix off by one error in track# calculation.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/ata/atapi-cd.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/dev/ata/atapi-cd.c b/sys/dev/ata/atapi-cd.c
index d36c2d1..6432506 100644
--- a/sys/dev/ata/atapi-cd.c
+++ b/sys/dev/ata/atapi-cd.c
@@ -489,7 +489,7 @@ acdopen(dev_t dev, int32_t flags, int32_t fmt, struct proc *p)
if (track) {
dev_t dev1 = makedev(major(dev), (dev->si_udev & 0xff0000ff));
- if (track < ((struct acd_softc *)(dev1->si_drv1))->toc.hdr.ending_track)
+ if (track <= ((struct acd_softc*)(dev1->si_drv1))->toc.hdr.ending_track)
dev->si_drv1 = dev1->si_drv1;
}
@@ -1128,11 +1128,11 @@ acd_start(struct atapi_softc *atp)
bzero(ccb, sizeof(ccb));
lba = bp->bio_offset / cdp->block_size;
- track = ((bp->bio_dev->si_udev & 0x00ff0000) >> 16) - 1;
+ track = (bp->bio_dev->si_udev & 0x00ff0000) >> 16;
if (track) {
- lba += ntohl(cdp->toc.tab[track].addr.lba);
- blocksize = (cdp->toc.tab[track].control & 4) ? 2048 : 2352;
+ lba += ntohl(cdp->toc.tab[track - 1].addr.lba);
+ blocksize = (cdp->toc.tab[track - 1].control & 4) ? 2048 : 2352;
}
else
blocksize = cdp->block_size;
OpenPOWER on IntegriCloud