linux-fsdevel.vger.kernel.org archive mirror
 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; 2+ 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] 2+ messages in thread

* [PATCH] seq_file: Remove pointless assignment in seq_read()
  2015-01-21 12:46 [PATCH] fs: Check return value of ->show_devname Jan Kara
@ 2015-01-21 12:46 ` Jan Kara
  0 siblings, 0 replies; 2+ messages in thread
From: Jan Kara @ 2015-01-21 12:46 UTC (permalink / raw)
  To: Al Viro; +Cc: linux-fsdevel, Andrew Morton, 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 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


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

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

Thread overview: 2+ 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).