__btrfs_std_error() neglects to call va_end() when doing early return
after testing "if (errno == -EROFS && (sb->s_flags & MS_RDONLY))" and
btrfs_printk() doesn't call va_end() at all.
This patch makes sure that va_end() is always properly called.

Signed-off-by: Jesper Juhl <j...@chaosbits.net>
---
 fs/btrfs/super.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 0eb9a4d..8566465 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -143,7 +143,7 @@ void __btrfs_std_error(struct btrfs_fs_info *fs_info, const 
char *function,
         * under MS_RDONLY, then it is safe here.
         */
        if (errno == -EROFS && (sb->s_flags & MS_RDONLY))
-               return;
+               goto out_va_end;
 
        errstr = btrfs_decode_error(fs_info, errno, nbuf);
        if (fmt) {
@@ -164,6 +164,7 @@ void __btrfs_std_error(struct btrfs_fs_info *fs_info, const 
char *function,
                save_error_info(fs_info);
                btrfs_handle_error(fs_info);
        }
+out_va_end:
        va_end(args);
 }
 
@@ -199,6 +200,7 @@ void btrfs_printk(struct btrfs_fs_info *fs_info, const char 
*fmt, ...)
        vaf.fmt = fmt;
        vaf.va = &args;
        printk("%sBTRFS %s (device %s): %pV", lvl, type, sb->s_id, &vaf);
+       va_end(args);
 }
 
 /*
-- 
1.7.11


-- 
Jesper Juhl <j...@chaosbits.net>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to