lseek(fd, n, SEEK_END) does *not* go to eof - n
When you copy some code, you are supposed to read it. If nothing else, there's a chance to spot and fix an obvious bug instead of sharing it... X-Song: "I Got It From Agnes", by Tom Lehrer Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> [ Tom Lehrer? You're dating yourself, Al ] Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
@@ -174,7 +174,7 @@ static loff_t fnic_trace_debugfs_lseek(struct file *file,
|
||||
pos = file->f_pos + offset;
|
||||
break;
|
||||
case 2:
|
||||
pos = fnic_dbg_prt->buffer_len - offset;
|
||||
pos = fnic_dbg_prt->buffer_len + offset;
|
||||
}
|
||||
return (pos < 0 || pos > fnic_dbg_prt->buffer_len) ?
|
||||
-EINVAL : (file->f_pos = pos);
|
||||
|
Reference in New Issue
Block a user