diff options
author | Eric Sandeen <sandeen@redhat.com> | 2013-01-30 19:54:58 -0500 |
---|---|---|
committer | Josef Bacik <jbacik@fusionio.com> | 2013-02-20 12:59:22 -0500 |
commit | 37252a66f34940421942725ca75d12e6008682dc (patch) | |
tree | d5d9d53f80736c7b2f13b5cca99c3c88cb845b75 | |
parent | 0e6360274ff3bd4fb8cf97c5c3483cf5a42a49f4 (diff) |
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>
-rw-r--r-- | fs/btrfs/super.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 976f6aac102e..e0ea1278377a 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, | |||
141 | struct super_block *sb = fs_info->sb; | 141 | struct super_block *sb = fs_info->sb; |
142 | char nbuf[16]; | 142 | char nbuf[16]; |
143 | const char *errstr; | 143 | const char *errstr; |
144 | va_list args; | ||
145 | va_start(args, fmt); | ||
146 | 144 | ||
147 | /* | 145 | /* |
148 | * Special case: if the error is EROFS, and we're already | 146 | * 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, | |||
153 | 151 | ||
154 | errstr = btrfs_decode_error(errno, nbuf); | 152 | errstr = btrfs_decode_error(errno, nbuf); |
155 | if (fmt) { | 153 | if (fmt) { |
156 | struct va_format vaf = { | 154 | struct va_format vaf; |
157 | .fmt = fmt, | 155 | va_list args; |
158 | .va = &args, | 156 | |
159 | }; | 157 | va_start(args, fmt); |
158 | vaf.fmt = fmt; | ||
159 | vaf.va = &args; | ||
160 | 160 | ||
161 | printk(KERN_CRIT "BTRFS error (device %s) in %s:%d: %s (%pV)\n", | 161 | printk(KERN_CRIT "BTRFS error (device %s) in %s:%d: %s (%pV)\n", |
162 | sb->s_id, function, line, errstr, &vaf); | 162 | sb->s_id, function, line, errstr, &vaf); |
163 | va_end(args); | ||
163 | } else { | 164 | } else { |
164 | printk(KERN_CRIT "BTRFS error (device %s) in %s:%d: %s\n", | 165 | printk(KERN_CRIT "BTRFS error (device %s) in %s:%d: %s\n", |
165 | sb->s_id, function, line, errstr); | 166 | sb->s_id, function, line, errstr); |
@@ -170,7 +171,6 @@ void __btrfs_std_error(struct btrfs_fs_info *fs_info, const char *function, | |||
170 | save_error_info(fs_info); | 171 | save_error_info(fs_info); |
171 | btrfs_handle_error(fs_info); | 172 | btrfs_handle_error(fs_info); |
172 | } | 173 | } |
173 | va_end(args); | ||
174 | } | 174 | } |
175 | 175 | ||
176 | static const char * const logtypes[] = { | 176 | static const char * const logtypes[] = { |