buglet in error-reporting ide-cd.c

Andries.Brouwer@cwi.nl
Sat, 28 Feb 1998 02:01:30 +0100 (MET)


In ide-cd.c a binary search is done to find an error
message with given 16-bit code. However, the right
message "Illegal mode for this track" is not returned
for code 0x6400 because nearby codes are negative.
Things get better by declaring the codes to be unsigned.
The trivial patch follows.

[I looked at this because people complained that fdisk
spews a lot of nonsense when applied to /dev/hdc when
that device happens to be a CD reader with audio CD.
And indeed, a lot of nonsense is printed, not by fdisk
but by the kernel. Probably the kernel should not print
anything in such situations where no hardware error is
involved. The read should just return -1 and set EIO or so.]

Andries

diff -u --recursive --new-file ../linux-2.1.88/linux/drivers/block/ide-cd.c ./linux/drivers/block/ide-cd.c
--- ../linux-2.1.88/linux/drivers/block/ide-cd.c Fri Feb 27 01:56:15 1998
+++ ./linux/drivers/block/ide-cd.c Sat Feb 28 01:39:18 1998
@@ -285,7 +285,7 @@
s = buf;
} else {
int lo, hi;
- int key = (reqbuf->asc << 8);
+ unsigned short key = (reqbuf->asc << 8);
if ( ! (reqbuf->ascq >= 0x80 && reqbuf->ascq <= 0xdd) )
key |= reqbuf->ascq;

diff -u --recursive --new-file ../linux-2.1.88/linux/drivers/block/ide-cd.h ./linux/drivers/block/ide-cd.h
--- ../linux-2.1.88/linux/drivers/block/ide-cd.h Wed Dec 17 20:11:51 1997
+++ ./linux/drivers/block/ide-cd.h Sat Feb 28 01:38:04 1998
@@ -431,7 +431,7 @@
with additions from Tables 141 and 142 of the ATAPI 2.6 draft standard. */

struct {
- short asc_ascq;
+ unsigned short asc_ascq;
char *text;
} sense_data_texts[] = {
{ 0x0000, "No additional sense information" },

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu