* [PATCH] vfs: show_vfsstat: do not ignore errors from show_devname method
@ 2015-03-19 11:30 Dmitry V. Levin
2015-11-18 17:42 ` [RESEND PATCH] " Dmitry V. Levin
0 siblings, 1 reply; 17+ messages in thread
From: Dmitry V. Levin @ 2015-03-19 11:30 UTC (permalink / raw)
To: Alexander Viro; +Cc: linux-fsdevel, linux-kernel
Explicitly check show_devname method return code and bail out in case
of an error. This fixes regression introduced by commit 9d4d65748a5c.
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
---
fs/proc_namespace.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/fs/proc_namespace.c b/fs/proc_namespace.c
index 8db932d..a5644c4 100644
--- a/fs/proc_namespace.c
+++ b/fs/proc_namespace.c
@@ -196,17 +196,19 @@ 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 ");
mangle(m, r->mnt_devname);
} else
seq_puts(m, "no device");
}
/* mount point */
seq_puts(m, " mounted on ");
/* mountpoints outside of chroot jail will give SEQ_SKIP on this */
err = seq_path_root(m, &mnt_path, &p->root, " \t\n\\");
if (err)
goto out;
--
ldv
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [RESEND PATCH] vfs: show_vfsstat: do not ignore errors from show_devname method
2015-03-19 11:30 [PATCH] vfs: show_vfsstat: do not ignore errors from show_devname method Dmitry V. Levin
@ 2015-11-18 17:42 ` Dmitry V. Levin
2015-11-18 18:02 ` Mateusz Guzik
2016-01-11 15:36 ` [RESEND v2 PATCH] vfs: show_vfsstat: do not ignore errors from show_devname method Dmitry V. Levin
0 siblings, 2 replies; 17+ messages in thread
From: Dmitry V. Levin @ 2015-11-18 17:42 UTC (permalink / raw)
To: Alexander Viro; +Cc: linux-fsdevel, linux-kernel
Date: Thu, 19 Mar 2015 11:10:54 +0000
Explicitly check show_devname method return code and bail out in case
of an error. This fixes regression introduced by commit 9d4d65748a5c.
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
---
fs/proc_namespace.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/fs/proc_namespace.c b/fs/proc_namespace.c
index 8ebd9a3..876459559 100644
--- a/fs/proc_namespace.c
+++ b/fs/proc_namespace.c
@@ -197,17 +197,19 @@ 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 ");
mangle(m, r->mnt_devname);
} else
seq_puts(m, "no device");
}
/* mount point */
seq_puts(m, " mounted on ");
/* mountpoints outside of chroot jail will give SEQ_SKIP on this */
err = seq_path_root(m, &mnt_path, &p->root, " \t\n\\");
if (err)
goto out;
--
ldv
^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [RESEND PATCH] vfs: show_vfsstat: do not ignore errors from show_devname method
2015-11-18 17:42 ` [RESEND PATCH] " Dmitry V. Levin
@ 2015-11-18 18:02 ` Mateusz Guzik
2015-11-18 21:57 ` [PATCH 1/3] vfs: show_vfsmnt: remove redundant initialization of error code Dmitry V. Levin
` (6 more replies)
2016-01-11 15:36 ` [RESEND v2 PATCH] vfs: show_vfsstat: do not ignore errors from show_devname method Dmitry V. Levin
1 sibling, 7 replies; 17+ messages in thread
From: Mateusz Guzik @ 2015-11-18 18:02 UTC (permalink / raw)
To: Dmitry V. Levin; +Cc: Alexander Viro, linux-fsdevel, linux-kernel
On Wed, Nov 18, 2015 at 08:42:48PM +0300, Dmitry V. Levin wrote:
> Date: Thu, 19 Mar 2015 11:10:54 +0000
>
> Explicitly check show_devname method return code and bail out in case
> of an error. This fixes regression introduced by commit 9d4d65748a5c.
>
> Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
> ---
> fs/proc_namespace.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/fs/proc_namespace.c b/fs/proc_namespace.c
> index 8ebd9a3..876459559 100644
> --- a/fs/proc_namespace.c
> +++ b/fs/proc_namespace.c
> @@ -197,17 +197,19 @@ 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 ");
> mangle(m, r->mnt_devname);
> } else
> seq_puts(m, "no device");
> }
>
> /* mount point */
> seq_puts(m, " mounted on ");
> /* mountpoints outside of chroot jail will give SEQ_SKIP on this */
> err = seq_path_root(m, &mnt_path, &p->root, " \t\n\\");
> if (err)
> goto out;
>
I would suggest this should also remove now spurious initialization of
err to 0 and now always-true !err check prior to calling ->show_stats.
--
Mateusz Guzik
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 1/3] vfs: show_vfsmnt: remove redundant initialization of error code
2015-11-18 18:02 ` Mateusz Guzik
@ 2015-11-18 21:57 ` Dmitry V. Levin
2016-01-11 15:36 ` [RESEND PATCH " Dmitry V. Levin
2015-11-18 21:58 ` [PATCH 2/3] vfs: show_mountinfo: cleanup error code checks Dmitry V. Levin
` (5 subsequent siblings)
6 siblings, 1 reply; 17+ messages in thread
From: Dmitry V. Levin @ 2015-11-18 21:57 UTC (permalink / raw)
To: Mateusz Guzik; +Cc: Alexander Viro, linux-fsdevel, linux-kernel
As err variable is now always checked right after the first assignment,
its initialization is redundant and could be safely removed.
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
---
fs/proc_namespace.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/proc_namespace.c b/fs/proc_namespace.c
index 876459559..cbc9c27 100644
--- a/fs/proc_namespace.c
+++ b/fs/proc_namespace.c
@@ -95,9 +95,9 @@ static int show_vfsmnt(struct seq_file *m, struct vfsmount *mnt)
{
struct proc_mounts *p = m->private;
struct mount *r = real_mount(mnt);
- int err = 0;
struct path mnt_path = { .dentry = mnt->mnt_root, .mnt = mnt };
struct super_block *sb = mnt_path.dentry->d_sb;
+ int err;
if (sb->s_op->show_devname) {
err = sb->s_op->show_devname(m, mnt_path.dentry);
--
ldv
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 2/3] vfs: show_mountinfo: cleanup error code checks
2015-11-18 18:02 ` Mateusz Guzik
2015-11-18 21:57 ` [PATCH 1/3] vfs: show_vfsmnt: remove redundant initialization of error code Dmitry V. Levin
@ 2015-11-18 21:58 ` Dmitry V. Levin
2016-01-11 15:37 ` [RESEND PATCH " Dmitry V. Levin
2015-11-18 21:58 ` [PATCH 3/3] vfs: show_vfsstat: remove redundant initialization and check of error code Dmitry V. Levin
` (4 subsequent siblings)
6 siblings, 1 reply; 17+ messages in thread
From: Dmitry V. Levin @ 2015-11-18 21:58 UTC (permalink / raw)
To: Mateusz Guzik; +Cc: Alexander Viro, linux-fsdevel, linux-kernel
Check err variable right after each assignment. This change makes
initialization of err redundant, so remove the initialization.
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
---
fs/proc_namespace.c | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/fs/proc_namespace.c b/fs/proc_namespace.c
index cbc9c27..7a6b2f3 100644
--- a/fs/proc_namespace.c
+++ b/fs/proc_namespace.c
@@ -131,16 +131,17 @@ static int show_mountinfo(struct seq_file *m, struct vfsmount *mnt)
struct mount *r = real_mount(mnt);
struct super_block *sb = mnt->mnt_sb;
struct path mnt_path = { .dentry = mnt->mnt_root, .mnt = mnt };
- int err = 0;
+ int err;
seq_printf(m, "%i %i %u:%u ", r->mnt_id, r->mnt_parent->mnt_id,
MAJOR(sb->s_dev), MINOR(sb->s_dev));
- if (sb->s_op->show_path)
+ if (sb->s_op->show_path) {
err = sb->s_op->show_path(m, mnt->mnt_root);
- else
+ if (err)
+ goto out;
+ } else {
seq_dentry(m, mnt->mnt_root, " \t\n\\");
- if (err)
- goto out;
+ }
seq_putc(m, ' ');
/* mountpoints outside of chroot jail will give SEQ_SKIP on this */
@@ -168,12 +169,13 @@ static int show_mountinfo(struct seq_file *m, struct vfsmount *mnt)
seq_puts(m, " - ");
show_type(m, sb);
seq_putc(m, ' ');
- if (sb->s_op->show_devname)
+ if (sb->s_op->show_devname) {
err = sb->s_op->show_devname(m, mnt->mnt_root);
- else
+ if (err)
+ goto out;
+ } else {
mangle(m, r->mnt_devname ? r->mnt_devname : "none");
- if (err)
- goto out;
+ }
seq_puts(m, sb->s_flags & MS_RDONLY ? " ro" : " rw");
err = show_sb_opts(m, sb);
if (err)
--
ldv
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 3/3] vfs: show_vfsstat: remove redundant initialization and check of error code
2015-11-18 18:02 ` Mateusz Guzik
2015-11-18 21:57 ` [PATCH 1/3] vfs: show_vfsmnt: remove redundant initialization of error code Dmitry V. Levin
2015-11-18 21:58 ` [PATCH 2/3] vfs: show_mountinfo: cleanup error code checks Dmitry V. Levin
@ 2015-11-18 21:58 ` Dmitry V. Levin
2016-01-11 15:37 ` [RESEND PATCH " Dmitry V. Levin
2015-12-02 17:20 ` [RESEND v2 PATCH 1/4] vfs: show_vfsstat: do not ignore errors from show_devname method Dmitry V. Levin
` (3 subsequent siblings)
6 siblings, 1 reply; 17+ messages in thread
From: Dmitry V. Levin @ 2015-11-18 21:58 UTC (permalink / raw)
To: Mateusz Guzik; +Cc: Alexander Viro, linux-fsdevel, linux-kernel
As err variable is now always checked right after each assignment, its
initialization is redundant and could be safely removed. For the same
reason, the last check of err is also redundant and could be removed as
well.
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
---
fs/proc_namespace.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/fs/proc_namespace.c b/fs/proc_namespace.c
index 7a6b2f3..3f1190d 100644
--- a/fs/proc_namespace.c
+++ b/fs/proc_namespace.c
@@ -193,7 +193,7 @@ static int show_vfsstat(struct seq_file *m, struct vfsmount *mnt)
struct mount *r = real_mount(mnt);
struct path mnt_path = { .dentry = mnt->mnt_root, .mnt = mnt };
struct super_block *sb = mnt_path.dentry->d_sb;
- int err = 0;
+ int err;
/* device */
if (sb->s_op->show_devname) {
@@ -224,8 +224,7 @@ static int show_vfsstat(struct seq_file *m, struct vfsmount *mnt)
/* optional statistics */
if (sb->s_op->show_stats) {
seq_putc(m, ' ');
- if (!err)
- err = sb->s_op->show_stats(m, mnt_path.dentry);
+ err = sb->s_op->show_stats(m, mnt_path.dentry);
}
seq_putc(m, '\n');
--
ldv
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [RESEND v2 PATCH 1/4] vfs: show_vfsstat: do not ignore errors from show_devname method
2015-11-18 18:02 ` Mateusz Guzik
` (2 preceding siblings ...)
2015-11-18 21:58 ` [PATCH 3/3] vfs: show_vfsstat: remove redundant initialization and check of error code Dmitry V. Levin
@ 2015-12-02 17:20 ` Dmitry V. Levin
2015-12-02 17:20 ` [RESEND PATCH 2/4] vfs: show_vfsmnt: remove redundant initialization of error code Dmitry V. Levin
` (2 subsequent siblings)
6 siblings, 0 replies; 17+ messages in thread
From: Dmitry V. Levin @ 2015-12-02 17:20 UTC (permalink / raw)
To: Alexander Viro; +Cc: Mateusz Guzik, linux-fsdevel, linux-kernel
Date: Thu, 19 Mar 2015 11:10:54 +0000
Explicitly check show_devname method return code and bail out in case
of an error. This fixes regression introduced by commit 9d4d65748a5c.
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
---
fs/proc_namespace.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/fs/proc_namespace.c b/fs/proc_namespace.c
index 8ebd9a3..876459559 100644
--- a/fs/proc_namespace.c
+++ b/fs/proc_namespace.c
@@ -197,17 +197,19 @@ 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 ");
mangle(m, r->mnt_devname);
} else
seq_puts(m, "no device");
}
/* mount point */
seq_puts(m, " mounted on ");
/* mountpoints outside of chroot jail will give SEQ_SKIP on this */
err = seq_path_root(m, &mnt_path, &p->root, " \t\n\\");
if (err)
goto out;
--
ldv
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [RESEND PATCH 2/4] vfs: show_vfsmnt: remove redundant initialization of error code
2015-11-18 18:02 ` Mateusz Guzik
` (3 preceding siblings ...)
2015-12-02 17:20 ` [RESEND v2 PATCH 1/4] vfs: show_vfsstat: do not ignore errors from show_devname method Dmitry V. Levin
@ 2015-12-02 17:20 ` Dmitry V. Levin
2015-12-02 17:20 ` [RESEND PATCH 3/4] vfs: show_mountinfo: cleanup error code checks Dmitry V. Levin
2015-12-02 17:20 ` [RESEND PATCH 4/4] vfs: show_vfsstat: remove redundant initialization and check of error code Dmitry V. Levin
6 siblings, 0 replies; 17+ messages in thread
From: Dmitry V. Levin @ 2015-12-02 17:20 UTC (permalink / raw)
To: Alexander Viro; +Cc: Mateusz Guzik, linux-fsdevel, linux-kernel
Date: Wed, 18 Nov 2015 21:07:10 +0000
As err variable is now always checked right after the first assignment,
its initialization is redundant and could be safely removed.
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
---
fs/proc_namespace.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/proc_namespace.c b/fs/proc_namespace.c
index 876459559..cbc9c27 100644
--- a/fs/proc_namespace.c
+++ b/fs/proc_namespace.c
@@ -95,9 +95,9 @@ static int show_vfsmnt(struct seq_file *m, struct vfsmount *mnt)
{
struct proc_mounts *p = m->private;
struct mount *r = real_mount(mnt);
- int err = 0;
struct path mnt_path = { .dentry = mnt->mnt_root, .mnt = mnt };
struct super_block *sb = mnt_path.dentry->d_sb;
+ int err;
if (sb->s_op->show_devname) {
err = sb->s_op->show_devname(m, mnt_path.dentry);
--
ldv
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [RESEND PATCH 3/4] vfs: show_mountinfo: cleanup error code checks
2015-11-18 18:02 ` Mateusz Guzik
` (4 preceding siblings ...)
2015-12-02 17:20 ` [RESEND PATCH 2/4] vfs: show_vfsmnt: remove redundant initialization of error code Dmitry V. Levin
@ 2015-12-02 17:20 ` Dmitry V. Levin
2015-12-02 17:20 ` [RESEND PATCH 4/4] vfs: show_vfsstat: remove redundant initialization and check of error code Dmitry V. Levin
6 siblings, 0 replies; 17+ messages in thread
From: Dmitry V. Levin @ 2015-12-02 17:20 UTC (permalink / raw)
To: Alexander Viro; +Cc: Mateusz Guzik, linux-fsdevel, linux-kernel
Wed, 18 Nov 2015 21:08:33 +0000
Check err variable right after each assignment. This change makes
initialization of err redundant, so remove the initialization.
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
---
fs/proc_namespace.c | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/fs/proc_namespace.c b/fs/proc_namespace.c
index cbc9c27..7a6b2f3 100644
--- a/fs/proc_namespace.c
+++ b/fs/proc_namespace.c
@@ -131,16 +131,17 @@ static int show_mountinfo(struct seq_file *m, struct vfsmount *mnt)
struct mount *r = real_mount(mnt);
struct super_block *sb = mnt->mnt_sb;
struct path mnt_path = { .dentry = mnt->mnt_root, .mnt = mnt };
- int err = 0;
+ int err;
seq_printf(m, "%i %i %u:%u ", r->mnt_id, r->mnt_parent->mnt_id,
MAJOR(sb->s_dev), MINOR(sb->s_dev));
- if (sb->s_op->show_path)
+ if (sb->s_op->show_path) {
err = sb->s_op->show_path(m, mnt->mnt_root);
- else
+ if (err)
+ goto out;
+ } else {
seq_dentry(m, mnt->mnt_root, " \t\n\\");
- if (err)
- goto out;
+ }
seq_putc(m, ' ');
/* mountpoints outside of chroot jail will give SEQ_SKIP on this */
@@ -168,12 +169,13 @@ static int show_mountinfo(struct seq_file *m, struct vfsmount *mnt)
seq_puts(m, " - ");
show_type(m, sb);
seq_putc(m, ' ');
- if (sb->s_op->show_devname)
+ if (sb->s_op->show_devname) {
err = sb->s_op->show_devname(m, mnt->mnt_root);
- else
+ if (err)
+ goto out;
+ } else {
mangle(m, r->mnt_devname ? r->mnt_devname : "none");
- if (err)
- goto out;
+ }
seq_puts(m, sb->s_flags & MS_RDONLY ? " ro" : " rw");
err = show_sb_opts(m, sb);
if (err)
--
ldv
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [RESEND PATCH 4/4] vfs: show_vfsstat: remove redundant initialization and check of error code
2015-11-18 18:02 ` Mateusz Guzik
` (5 preceding siblings ...)
2015-12-02 17:20 ` [RESEND PATCH 3/4] vfs: show_mountinfo: cleanup error code checks Dmitry V. Levin
@ 2015-12-02 17:20 ` Dmitry V. Levin
6 siblings, 0 replies; 17+ messages in thread
From: Dmitry V. Levin @ 2015-12-02 17:20 UTC (permalink / raw)
To: Alexander Viro; +Cc: Mateusz Guzik, linux-fsdevel, linux-kernel
Date: Wed, 18 Nov 2015 21:09:45 +0000
As err variable is now always checked right after each assignment, its
initialization is redundant and could be safely removed. For the same
reason, the last check of err is also redundant and could be removed as
well.
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
---
fs/proc_namespace.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/fs/proc_namespace.c b/fs/proc_namespace.c
index 7a6b2f3..3f1190d 100644
--- a/fs/proc_namespace.c
+++ b/fs/proc_namespace.c
@@ -193,7 +193,7 @@ static int show_vfsstat(struct seq_file *m, struct vfsmount *mnt)
struct mount *r = real_mount(mnt);
struct path mnt_path = { .dentry = mnt->mnt_root, .mnt = mnt };
struct super_block *sb = mnt_path.dentry->d_sb;
- int err = 0;
+ int err;
/* device */
if (sb->s_op->show_devname) {
@@ -224,8 +224,7 @@ static int show_vfsstat(struct seq_file *m, struct vfsmount *mnt)
/* optional statistics */
if (sb->s_op->show_stats) {
seq_putc(m, ' ');
- if (!err)
- err = sb->s_op->show_stats(m, mnt_path.dentry);
+ err = sb->s_op->show_stats(m, mnt_path.dentry);
}
seq_putc(m, '\n');
--
ldv
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [RESEND v2 PATCH] vfs: show_vfsstat: do not ignore errors from show_devname method
2015-11-18 17:42 ` [RESEND PATCH] " Dmitry V. Levin
2015-11-18 18:02 ` Mateusz Guzik
@ 2016-01-11 15:36 ` Dmitry V. Levin
2016-02-19 1:56 ` [RESEND v3 " Dmitry V. Levin
1 sibling, 1 reply; 17+ messages in thread
From: Dmitry V. Levin @ 2016-01-11 15:36 UTC (permalink / raw)
To: Alexander Viro; +Cc: linux-fsdevel, linux-kernel
Date: Thu, 19 Mar 2015 11:10:54 +0000
Explicitly check show_devname method return code and bail out in case
of an error. This fixes regression introduced by commit 9d4d65748a5c.
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
---
fs/proc_namespace.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/fs/proc_namespace.c b/fs/proc_namespace.c
index 8ebd9a3..876459559 100644
--- a/fs/proc_namespace.c
+++ b/fs/proc_namespace.c
@@ -197,17 +197,19 @@ 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 ");
mangle(m, r->mnt_devname);
} else
seq_puts(m, "no device");
}
/* mount point */
seq_puts(m, " mounted on ");
/* mountpoints outside of chroot jail will give SEQ_SKIP on this */
err = seq_path_root(m, &mnt_path, &p->root, " \t\n\\");
if (err)
goto out;
--
ldv
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [RESEND PATCH 1/3] vfs: show_vfsmnt: remove redundant initialization of error code
2015-11-18 21:57 ` [PATCH 1/3] vfs: show_vfsmnt: remove redundant initialization of error code Dmitry V. Levin
@ 2016-01-11 15:36 ` Dmitry V. Levin
0 siblings, 0 replies; 17+ messages in thread
From: Dmitry V. Levin @ 2016-01-11 15:36 UTC (permalink / raw)
To: Alexander Viro; +Cc: Mateusz Guzik, linux-fsdevel, linux-kernel
Date: Wed Nov 18 21:07:10 2015 +0000
As err variable is now always checked right after the first assignment,
its initialization is redundant and could be safely removed.
Suggested-by: Mateusz Guzik <mguzik@redhat.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
---
fs/proc_namespace.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/proc_namespace.c b/fs/proc_namespace.c
index 876459559..cbc9c27 100644
--- a/fs/proc_namespace.c
+++ b/fs/proc_namespace.c
@@ -95,9 +95,9 @@ static int show_vfsmnt(struct seq_file *m, struct vfsmount *mnt)
{
struct proc_mounts *p = m->private;
struct mount *r = real_mount(mnt);
- int err = 0;
struct path mnt_path = { .dentry = mnt->mnt_root, .mnt = mnt };
struct super_block *sb = mnt_path.dentry->d_sb;
+ int err;
if (sb->s_op->show_devname) {
err = sb->s_op->show_devname(m, mnt_path.dentry);
--
ldv
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [RESEND PATCH 2/3] vfs: show_mountinfo: cleanup error code checks
2015-11-18 21:58 ` [PATCH 2/3] vfs: show_mountinfo: cleanup error code checks Dmitry V. Levin
@ 2016-01-11 15:37 ` Dmitry V. Levin
0 siblings, 0 replies; 17+ messages in thread
From: Dmitry V. Levin @ 2016-01-11 15:37 UTC (permalink / raw)
To: Alexander Viro; +Cc: Mateusz Guzik, linux-fsdevel, linux-kernel
Date: Wed Nov 18 21:08:33 2015 +0000
Check err variable right after each assignment. This change makes
initialization of err redundant, so remove the initialization.
Suggested-by: Mateusz Guzik <mguzik@redhat.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
---
fs/proc_namespace.c | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/fs/proc_namespace.c b/fs/proc_namespace.c
index cbc9c27..7a6b2f3 100644
--- a/fs/proc_namespace.c
+++ b/fs/proc_namespace.c
@@ -131,16 +131,17 @@ static int show_mountinfo(struct seq_file *m, struct vfsmount *mnt)
struct mount *r = real_mount(mnt);
struct super_block *sb = mnt->mnt_sb;
struct path mnt_path = { .dentry = mnt->mnt_root, .mnt = mnt };
- int err = 0;
+ int err;
seq_printf(m, "%i %i %u:%u ", r->mnt_id, r->mnt_parent->mnt_id,
MAJOR(sb->s_dev), MINOR(sb->s_dev));
- if (sb->s_op->show_path)
+ if (sb->s_op->show_path) {
err = sb->s_op->show_path(m, mnt->mnt_root);
- else
+ if (err)
+ goto out;
+ } else {
seq_dentry(m, mnt->mnt_root, " \t\n\\");
- if (err)
- goto out;
+ }
seq_putc(m, ' ');
/* mountpoints outside of chroot jail will give SEQ_SKIP on this */
@@ -168,12 +169,13 @@ static int show_mountinfo(struct seq_file *m, struct vfsmount *mnt)
seq_puts(m, " - ");
show_type(m, sb);
seq_putc(m, ' ');
- if (sb->s_op->show_devname)
+ if (sb->s_op->show_devname) {
err = sb->s_op->show_devname(m, mnt->mnt_root);
- else
+ if (err)
+ goto out;
+ } else {
mangle(m, r->mnt_devname ? r->mnt_devname : "none");
- if (err)
- goto out;
+ }
seq_puts(m, sb->s_flags & MS_RDONLY ? " ro" : " rw");
err = show_sb_opts(m, sb);
if (err)
--
ldv
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [RESEND PATCH 3/3] vfs: show_vfsstat: remove redundant initialization and check of error code
2015-11-18 21:58 ` [PATCH 3/3] vfs: show_vfsstat: remove redundant initialization and check of error code Dmitry V. Levin
@ 2016-01-11 15:37 ` Dmitry V. Levin
0 siblings, 0 replies; 17+ messages in thread
From: Dmitry V. Levin @ 2016-01-11 15:37 UTC (permalink / raw)
To: Alexander Viro; +Cc: Mateusz Guzik, linux-fsdevel, linux-kernel
Date: Wed Nov 18 21:09:45 2015 +0000
As err variable is now always checked right after each assignment, its
initialization is redundant and could be safely removed. For the same
reason, the last check of err is also redundant and could be removed as
well.
Suggested-by: Mateusz Guzik <mguzik@redhat.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
---
fs/proc_namespace.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/fs/proc_namespace.c b/fs/proc_namespace.c
index 7a6b2f3..3f1190d 100644
--- a/fs/proc_namespace.c
+++ b/fs/proc_namespace.c
@@ -193,7 +193,7 @@ static int show_vfsstat(struct seq_file *m, struct vfsmount *mnt)
struct mount *r = real_mount(mnt);
struct path mnt_path = { .dentry = mnt->mnt_root, .mnt = mnt };
struct super_block *sb = mnt_path.dentry->d_sb;
- int err = 0;
+ int err;
/* device */
if (sb->s_op->show_devname) {
@@ -224,8 +224,7 @@ static int show_vfsstat(struct seq_file *m, struct vfsmount *mnt)
/* optional statistics */
if (sb->s_op->show_stats) {
seq_putc(m, ' ');
- if (!err)
- err = sb->s_op->show_stats(m, mnt_path.dentry);
+ err = sb->s_op->show_stats(m, mnt_path.dentry);
}
seq_putc(m, '\n');
--
ldv
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [RESEND v3 PATCH] vfs: show_vfsstat: do not ignore errors from show_devname method
2016-01-11 15:36 ` [RESEND v2 PATCH] vfs: show_vfsstat: do not ignore errors from show_devname method Dmitry V. Levin
@ 2016-02-19 1:56 ` Dmitry V. Levin
2016-03-16 16:31 ` [RESEND v4 " Dmitry V. Levin
0 siblings, 1 reply; 17+ messages in thread
From: Dmitry V. Levin @ 2016-02-19 1:56 UTC (permalink / raw)
To: Alexander Viro; +Cc: linux-fsdevel, linux-kernel
Date: Thu, 19 Mar 2015 11:10:54 +0000
Explicitly check show_devname method return code and bail out in case
of an error. This fixes regression introduced by commit 9d4d65748a5c.
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
---
fs/proc_namespace.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/fs/proc_namespace.c b/fs/proc_namespace.c
index 2256e7e..3f1190d 100644
--- a/fs/proc_namespace.c
+++ b/fs/proc_namespace.c
@@ -190,26 +190,28 @@ out:
static int show_vfsstat(struct seq_file *m, struct vfsmount *mnt)
{
struct proc_mounts *p = m->private;
struct mount *r = real_mount(mnt);
struct path mnt_path = { .dentry = mnt->mnt_root, .mnt = mnt };
struct super_block *sb = mnt_path.dentry->d_sb;
int err;
/* device */
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 ");
mangle(m, r->mnt_devname);
} else
seq_puts(m, "no device");
}
/* mount point */
seq_puts(m, " mounted on ");
/* mountpoints outside of chroot jail will give SEQ_SKIP on this */
err = seq_path_root(m, &mnt_path, &p->root, " \t\n\\");
if (err)
goto out;
--
ldv
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [RESEND v4 PATCH] vfs: show_vfsstat: do not ignore errors from show_devname method
2016-02-19 1:56 ` [RESEND v3 " Dmitry V. Levin
@ 2016-03-16 16:31 ` Dmitry V. Levin
2016-03-16 16:49 ` Al Viro
0 siblings, 1 reply; 17+ messages in thread
From: Dmitry V. Levin @ 2016-03-16 16:31 UTC (permalink / raw)
To: Alexander Viro; +Cc: linux-fsdevel, linux-kernel
Date: Thu, 19 Mar 2015 11:10:54 +0000
Explicitly check show_devname method return code and bail out in case
of an error. This fixes regression introduced by commit 9d4d65748a5c.
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
---
fs/proc_namespace.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/fs/proc_namespace.c b/fs/proc_namespace.c
index 2256e7e..3f1190d 100644
--- a/fs/proc_namespace.c
+++ b/fs/proc_namespace.c
@@ -190,26 +190,28 @@ out:
static int show_vfsstat(struct seq_file *m, struct vfsmount *mnt)
{
struct proc_mounts *p = m->private;
struct mount *r = real_mount(mnt);
struct path mnt_path = { .dentry = mnt->mnt_root, .mnt = mnt };
struct super_block *sb = mnt_path.dentry->d_sb;
int err;
/* device */
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 ");
mangle(m, r->mnt_devname);
} else
seq_puts(m, "no device");
}
/* mount point */
seq_puts(m, " mounted on ");
/* mountpoints outside of chroot jail will give SEQ_SKIP on this */
err = seq_path_root(m, &mnt_path, &p->root, " \t\n\\");
if (err)
goto out;
--
ldv
^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [RESEND v4 PATCH] vfs: show_vfsstat: do not ignore errors from show_devname method
2016-03-16 16:31 ` [RESEND v4 " Dmitry V. Levin
@ 2016-03-16 16:49 ` Al Viro
0 siblings, 0 replies; 17+ messages in thread
From: Al Viro @ 2016-03-16 16:49 UTC (permalink / raw)
To: Dmitry V. Levin; +Cc: linux-fsdevel, linux-kernel
On Wed, Mar 16, 2016 at 07:31:22PM +0300, Dmitry V. Levin wrote:
> Date: Thu, 19 Mar 2015 11:10:54 +0000
>
> Explicitly check show_devname method return code and bail out in case
> of an error. This fixes regression introduced by commit 9d4d65748a5c.
Applied weeks ago, still not migrated into for-next; my apologies, thought
I pushed it to Linus at some point last cycle. I'll take it to for-next
in a few.
^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2016-03-16 16:49 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-19 11:30 [PATCH] vfs: show_vfsstat: do not ignore errors from show_devname method Dmitry V. Levin
2015-11-18 17:42 ` [RESEND PATCH] " Dmitry V. Levin
2015-11-18 18:02 ` Mateusz Guzik
2015-11-18 21:57 ` [PATCH 1/3] vfs: show_vfsmnt: remove redundant initialization of error code Dmitry V. Levin
2016-01-11 15:36 ` [RESEND PATCH " Dmitry V. Levin
2015-11-18 21:58 ` [PATCH 2/3] vfs: show_mountinfo: cleanup error code checks Dmitry V. Levin
2016-01-11 15:37 ` [RESEND PATCH " Dmitry V. Levin
2015-11-18 21:58 ` [PATCH 3/3] vfs: show_vfsstat: remove redundant initialization and check of error code Dmitry V. Levin
2016-01-11 15:37 ` [RESEND PATCH " Dmitry V. Levin
2015-12-02 17:20 ` [RESEND v2 PATCH 1/4] vfs: show_vfsstat: do not ignore errors from show_devname method Dmitry V. Levin
2015-12-02 17:20 ` [RESEND PATCH 2/4] vfs: show_vfsmnt: remove redundant initialization of error code Dmitry V. Levin
2015-12-02 17:20 ` [RESEND PATCH 3/4] vfs: show_mountinfo: cleanup error code checks Dmitry V. Levin
2015-12-02 17:20 ` [RESEND PATCH 4/4] vfs: show_vfsstat: remove redundant initialization and check of error code Dmitry V. Levin
2016-01-11 15:36 ` [RESEND v2 PATCH] vfs: show_vfsstat: do not ignore errors from show_devname method Dmitry V. Levin
2016-02-19 1:56 ` [RESEND v3 " Dmitry V. Levin
2016-03-16 16:31 ` [RESEND v4 " Dmitry V. Levin
2016-03-16 16:49 ` Al Viro
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).