mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-28 01:21:58 +00:00
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:
parent
7d13205581
commit
8177a9d79c
4 changed files with 4 additions and 4 deletions
|
@ -244,7 +244,7 @@ bnad_debugfs_lseek(struct file *file, loff_t offset, int orig)
|
||||||
file->f_pos += offset;
|
file->f_pos += offset;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
file->f_pos = debug->buffer_len - offset;
|
file->f_pos = debug->buffer_len + offset;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
|
@ -186,7 +186,7 @@ bfad_debugfs_lseek(struct file *file, loff_t offset, int orig)
|
||||||
file->f_pos += offset;
|
file->f_pos += offset;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
file->f_pos = debug->buffer_len - offset;
|
file->f_pos = debug->buffer_len + offset;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
|
@ -174,7 +174,7 @@ static loff_t fnic_trace_debugfs_lseek(struct file *file,
|
||||||
pos = file->f_pos + offset;
|
pos = file->f_pos + offset;
|
||||||
break;
|
break;
|
||||||
case 2:
|
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) ?
|
return (pos < 0 || pos > fnic_dbg_prt->buffer_len) ?
|
||||||
-EINVAL : (file->f_pos = pos);
|
-EINVAL : (file->f_pos = pos);
|
||||||
|
|
|
@ -1178,7 +1178,7 @@ lpfc_debugfs_lseek(struct file *file, loff_t off, int whence)
|
||||||
pos = file->f_pos + off;
|
pos = file->f_pos + off;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
pos = debug->len - off;
|
pos = debug->len + off;
|
||||||
}
|
}
|
||||||
return (pos < 0 || pos > debug->len) ? -EINVAL : (file->f_pos = pos);
|
return (pos < 0 || pos > debug->len) ? -EINVAL : (file->f_pos = pos);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue