All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: linux-fsdevel@vger.kernel.org, Jan Kara <jack@suse.cz>
Subject: [PATCH] seq_file: Remove pointless assignment in seq_read()
Date: Tue, 21 Oct 2014 17:12:03 +0200	[thread overview]
Message-ID: <1413904323-19043-1-git-send-email-jack@suse.cz> (raw)

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 3857b720cb1b..cf53252e4784 100644
--- a/fs/seq_file.c
+++ b/fs/seq_file.c
@@ -262,10 +262,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_overflow(m) || err) {
 			m->count = offs;
-- 
1.8.1.4


             reply	other threads:[~2014-10-21 15:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-21 15:12 Jan Kara [this message]
2015-01-21 12:46 [PATCH] fs: Check return value of ->show_devname Jan Kara
2015-01-21 12:46 ` [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=1413904323-19043-1-git-send-email-jack@suse.cz \
    --to=jack@suse.cz \
    --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.