Re: [PATCH] Re: Bugs(?) in the cdrom code

Ton Hospel (thospel@mail.dma.be)
28 Sep 1999 03:14:02 GMT


In article <19990927235636.A2796@image.dk>,
Jens Axboe <axboe@image.dk> writes:
> On Mon, Sep 27 1999, Eric Lammerts wrote:
>> > Possible bug in ide-cd.c ( ver. 4.53 ).
>> > The capacity as reported by cdrom_read_capacity() is one block too short for
>> > audio CDs on my system. ( Teac CD-532E-B as hdc on PIIX4 , Abit BH-6 board )
>>
>> > It also check for lba >= capacity ( it should be lba > capacity on my system
>> > to work OK with audio CDs )
>>
>> I checked the ATAPI spec and the test should indeed be lba > capacity.
>> On page 72 there's an example of a disk layout from which it is clear
>> that the READ_CD-ROM_CAPACITY returns the number of the last sector
>> that can be read. So reading with lba == capacity is valid.
>>
>> --- linux/drivers/block/ide-cd.c.orig Mon Sep 27 23:34:02 1999
>> +++ linux/drivers/block/ide-cd.c Mon Sep 27 23:34:18 1999
>> @@ -2188,7 +2188,7 @@
>> else
>> return -EINVAL;
>>
>> - if (lba < 0 || lba >= toc->capacity)
>> + if (lba < 0 || lba > toc->capacity)
>> return -EINVAL;
>>
>> buf = (char *) kmalloc (CDROM_NBLOCKS_BUFFER*CD_FRAMESIZE_RAW,
>
> You are right, I'll add the patch.
>

Isn't it better to just increase toc->capacity by 1, so it DOES
represent the "capacity" ?

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/