From 710591b7968585aa268a908e05440a9c9e3af5a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Schmidt?= Date: Sun, 13 Aug 2000 09:08:19 +0000 Subject: [PATCH] Fix off by one error in track# calculation. --- sys/dev/ata/atapi-cd.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/dev/ata/atapi-cd.c b/sys/dev/ata/atapi-cd.c index d36c2d119950..64325060eebe 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;