summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/super.c
diff options
context:
space:
mode:
authorEric Sandeen <sandeen@redhat.com>2013-01-31 00:54:58 +0000
committerJosef Bacik <jbacik@fusionio.com>2013-02-20 12:59:22 -0500
commit37252a66f34940421942725ca75d12e6008682dc (patch)
treed5d9d53f80736c7b2f13b5cca99c3c88cb845b75 /fs/btrfs/super.c
parent0e6360274ff3bd4fb8cf97c5c3483cf5a42a49f4 (diff)
downloadop-kernel-dev-37252a66f34940421942725ca75d12e6008682dc.zip
op-kernel-dev-37252a66f34940421942725ca75d12e6008682dc.tar.gz
btrfs: fix varargs in __btrfs_std_error
__btrfs_std_error didn't always properly call va_end, and might call va_start even if fmt was NULL. Move all the varargs handling into the block where we have fmt. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Diffstat (limited to 'fs/btrfs/super.c')
-rw-r--r--fs/btrfs/super.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 976f6aa..e0ea127 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -141,8 +141,6 @@ void __btrfs_std_error(struct btrfs_fs_info *fs_info, const char *function,
struct super_block *sb = fs_info->sb;
char nbuf[16];
const char *errstr;
- va_list args;
- va_start(args, fmt);
/*
* Special case: if the error is EROFS, and we're already
@@ -153,13 +151,16 @@ void __btrfs_std_error(struct btrfs_fs_info *fs_info, const char *function,
errstr = btrfs_decode_error(errno, nbuf);
if (fmt) {
- struct va_format vaf = {
- .fmt = fmt,
- .va = &args,
- };
+ struct va_format vaf;
+ va_list args;
+
+ va_start(args, fmt);
+ vaf.fmt = fmt;
+ vaf.va = &args;
printk(KERN_CRIT "BTRFS error (device %s) in %s:%d: %s (%pV)\n",
sb->s_id, function, line, errstr, &vaf);
+ va_end(args);
} else {
printk(KERN_CRIT "BTRFS error (device %s) in %s:%d: %s\n",
sb->s_id, function, line, errstr);
@@ -170,7 +171,6 @@ void __btrfs_std_error(struct btrfs_fs_info *fs_info, const char *function,
save_error_info(fs_info);
btrfs_handle_error(fs_info);
}
- va_end(args);
}
static const char * const logtypes[] = {
OpenPOWER on IntegriCloud