[PATCH] Btrfs: Ensure va_end() is always called in __btrfs_std_error()and btrfs_printk()

From: Jesper Juhl
Date: Thu Jun 21 2012 - 19:53:28 EST


__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 <jj@xxxxxxxxxxxxx>
---
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 <jj@xxxxxxxxxxxxx> 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-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/