[PATCH] /dev/mem: Allow rewinding
From: Eric Dumazet
Date: Mon Apr 05 2010 - 17:19:23 EST
Le lundi 05 avril 2010 Ã 23:04 +0200, Eric Dumazet a Ãcrit :
> Andrew, commit dcefafb6ac90ece8d68a6c203105f3d313e52da4 seems to be the
> problem.
>
> It breaks rewinds (negative offsets to lseek (... SEEK_CUR))
>
Here is a patch to make rewind working again on /dev/mem
[PATCH] /dev/mem: Allow rewinding
commit dcefafb6 (/dev/mem: dont allow seek to last page)
inadvertently disabled rewinding on /dev/mem.
This broke x86info for example.
Signed-off-by: Eric Dumazet <eric.dumazet@xxxxxxxxx>
---
diff --git a/drivers/char/mem.c b/drivers/char/mem.c
index 1f3215a..3973a1d 100644
--- a/drivers/char/mem.c
+++ b/drivers/char/mem.c
@@ -710,11 +710,6 @@ static loff_t memory_lseek(struct file *file, loff_t offset, int orig)
switch (orig) {
case SEEK_CUR:
offset += file->f_pos;
- if ((unsigned long long)offset <
- (unsigned long long)file->f_pos) {
- ret = -EOVERFLOW;
- break;
- }
case SEEK_SET:
/* to avoid userland mistaking f_pos=-9 as -EBADF=-9 */
if ((unsigned long long)offset >= ~0xFFFULL) {
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/