All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fs: Check return value of ->show_devname
@ 2015-01-21 12:46 Jan Kara
  2015-01-21 12:46 ` [PATCH] seq_file: Remove pointless assignment in seq_read() Jan Kara
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Kara @ 2015-01-21 12:46 UTC (permalink / raw)
  To: Al Viro; +Cc: linux-fsdevel, Andrew Morton, Jan Kara

show_vfsstat() isn't checking the return value of ->show_devname().
Check it and bail out properly.

Coverity-id: 1260113
Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/proc_namespace.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/proc_namespace.c b/fs/proc_namespace.c
index 0f96f71ab32b..a29f17a9070f 100644
--- a/fs/proc_namespace.c
+++ b/fs/proc_namespace.c
@@ -195,6 +195,8 @@ static int show_vfsstat(struct seq_file *m, struct vfsmount *mnt)
 	if (sb->s_op->show_devname) {
 		seq_puts(m, "device ");
 		err = sb->s_op->show_devname(m, mnt_path.dentry);
+		if (err)
+			goto out;
 	} else {
 		if (r->mnt_devname) {
 			seq_puts(m, "device ");
-- 
2.1.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread
* [PATCH] seq_file: Remove pointless assignment in seq_read()
@ 2014-10-21 15:12 Jan Kara
  0 siblings, 0 replies; 3+ messages in thread
From: Jan Kara @ 2014-10-21 15:12 UTC (permalink / raw)
  To: Alexander Viro; +Cc: linux-fsdevel, Jan Kara

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-01-21 12:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
  -- strict thread matches above, loose matches on Subject: below --
2014-10-21 15:12 Jan Kara

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.