linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] 2.4.20 drivers/cdrom/cdu31a.c
@ 2003-02-07 13:43 Mauricio Martinez
  2003-02-07 15:48 ` Corey Minyard
  0 siblings, 1 reply; 5+ messages in thread
From: Mauricio Martinez @ 2003-02-07 13:43 UTC (permalink / raw)
  To: linux-kernel


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. */


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2003-02-14 13:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-07 13:43 [PATCH] 2.4.20 drivers/cdrom/cdu31a.c Mauricio Martinez
2003-02-07 15:48 ` Corey Minyard
2003-02-11 18:10   ` Mauricio Martinez
2003-02-11 18:52     ` Corey Minyard
2003-02-14 13:53       ` Mauricio Martinez

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).