[PATCH] socket: No need to check for ki_pos != 0 anymore

From: Kirill Smelkov
Date: Tue Nov 26 2019 - 04:40:56 EST


Commit d8e464ecc17b (vfs: mark pipes and sockets as stream-like file
descriptors) converted sockets to use stream_open() which forbids llseek
and sets FMODE_STREAM for which VFS ksys_read/ksys_write routines make
sure not to change file->f_pos at all and always pass either ppos=NULL,
or ki->ki_pos=0 to fops->read/write, because there is no file position
for stream-like files.

Drop unnecessary checks.

Signed-off-by: Kirill Smelkov <kirr@xxxxxxxxxx>
---
net/socket.c | 6 ------
1 file changed, 6 deletions(-)

diff --git a/net/socket.c b/net/socket.c
index 17bc1eee198a..d8c583c755ae 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -959,9 +959,6 @@ static ssize_t sock_read_iter(struct kiocb *iocb, struct iov_iter *to)
if (file->f_flags & O_NONBLOCK)
msg.msg_flags = MSG_DONTWAIT;

- if (iocb->ki_pos != 0)
- return -ESPIPE;
-
if (!iov_iter_count(to)) /* Match SYS5 behaviour */
return 0;

@@ -978,9 +975,6 @@ static ssize_t sock_write_iter(struct kiocb *iocb, struct iov_iter *from)
.msg_iocb = iocb};
ssize_t res;

- if (iocb->ki_pos != 0)
- return -ESPIPE;
-
if (file->f_flags & O_NONBLOCK)
msg.msg_flags = MSG_DONTWAIT;

--
2.20.1