small bug in memory_lseek()

David Wragg (dpw@doc.ic.ac.uk)
Thu, 12 Feb 1998 02:35:46 GMT


Hi,

In memory_lseek() in drivers/char/mem.c, the code to stop successful
seeks on negative offsets giving what look like error returns (as
described in the comment) is never reached. A patch to fix this
follows.

This bug causes the klogd in RedHat5.0 to fail with a syslog message
something like "error seeking on /dev/kmem", as observed by David
Burrows a bit ago.

Dave Wragg.

diff -rub linux-2.1.86/drivers/char/mem.c linux-2.1.86.kmem/drivers/char/mem.c
--- linux-2.1.86/drivers/char/mem.c Tue Jan 27 20:28:36 1998
+++ linux-2.1.86.kmem/drivers/char/mem.c Thu Feb 12 01:58:00 1998
@@ -374,10 +374,10 @@
switch (orig) {
case 0:
file->f_pos = offset;
- return file->f_pos;
+ break;
case 1:
file->f_pos += offset;
- return file->f_pos;
+ break;
default:
return -EINVAL;
}

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