From: Jan Kara <jack@suse.cz>
To: Al Viro <viro@ZenIV.linux.org.uk>
Cc: linux-fsdevel@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>,
Jan Kara <jack@suse.cz>
Subject: [PATCH] seq_file: Remove pointless assignment in seq_read()
Date: Wed, 21 Jan 2015 13:46:52 +0100 [thread overview]
Message-ID: <1421844412-15398-2-git-send-email-jack@suse.cz> (raw)
In-Reply-To: <1421844412-15398-1-git-send-email-jack@suse.cz>
The value assigned to 'err' in seq_read() is overwritten by the result
of copy_to_user(). This is correct because we know we have succeeded to
generate at least one entry into user buffer so the error we got when
generating further entries is irrelevant. Just remove the assignment.
Coverity-id: 1226981
Signed-off-by: Jan Kara <jack@suse.cz>
---
fs/seq_file.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/fs/seq_file.c b/fs/seq_file.c
index dbf3a59c86bb..548f78308e2a 100644
--- a/fs/seq_file.c
+++ b/fs/seq_file.c
@@ -255,10 +255,8 @@ Fill:
size_t offs = m->count;
loff_t next = pos;
p = m->op->next(m, p, &next);
- if (!p || IS_ERR(p)) {
- err = PTR_ERR(p);
+ if (!p || IS_ERR(p))
break;
- }
err = m->op->show(m, p);
if (seq_has_overflowed(m) || err) {
m->count = offs;
--
2.1.2
next prev parent reply other threads:[~2015-01-21 12:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-21 12:46 [PATCH] fs: Check return value of ->show_devname Jan Kara
2015-01-21 12:46 ` Jan Kara [this message]
-- strict thread matches above, loose matches on Subject: below --
2014-10-21 15:12 [PATCH] seq_file: Remove pointless assignment in seq_read() Jan Kara
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1421844412-15398-2-git-send-email-jack@suse.cz \
--to=jack@suse.cz \
--cc=akpm@linux-foundation.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=viro@ZenIV.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.