Messages in this thread Patch in this message | ![/](/images/icornerl.gif) | | Date | Fri, 7 Feb 2003 08:43:26 -0500 (EST) | From | Mauricio Martinez <> | Subject | [PATCH] 2.4.20 drivers/cdrom/cdu31a.c |
| |
This patch fixes the kernel oops while trying to read a data CD. Thanks to Brian Gerst and Faik Uygur for your suggestions.
It looks like the variable nblocks must be <= 4 so the read ahead buffer size is not exceeded (which is the cause of the oops). Changing its value doesn't seem to be the right way, but it makes the device work properly.
Feedback of any sort welcome.
--- linux-2.4.20/drivers/cdrom/cdu31a.c.orig Thu Nov 28 15:53:12 2002 +++ linux-2.4.20/drivers/cdrom/cdu31a.c Thu Feb 6 20:49:44 2003 @@ -1361,7 +1361,9 @@ res_reg[0] = 0; res_reg[1] = 0; *res_size = 0; - bytesleft = nblocks * 512; + /* Make sure that bytesleft doesn't exceed the buffer size */ + if (nblocks > 4) nblocks = 4; + bytesleft = nblocks * 512; offset = 0;
/* If the data in the read-ahead does not match the block offset, @@ -1384,9 +1386,9 @@ readahead_buffer + (2048 - readahead_dataleft), readahead_dataleft); - readahead_dataleft = 0; bytesleft -= readahead_dataleft; offset += readahead_dataleft; + readahead_dataleft = 0; } else { /* The readahead will fill the whole buffer, get the data and return. */ - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| ![\](/images/icornerr.gif) |