1 From: Jeff Mahoney <jeffm@suse.com>
2 Subject: [PATCH] reiserfs: prepare_error_buf wrongly consumes va_arg
4 vsprintf will consume varargs on its own. Skipping them manually
5 results in garbage in the error buffer, or Oopses in the case of
8 This patch removes the advancement and fixes a number of bugs where
9 crashes were observed as side effects of a regular error report.
11 Signed-off-by: Jeff Mahoney <jeffm@suse.com>
14 fs/reiserfs/prints.c | 12 +++---------
15 1 file changed, 3 insertions(+), 9 deletions(-)
17 --- a/fs/reiserfs/prints.c
18 +++ b/fs/reiserfs/prints.c
19 @@ -157,19 +157,16 @@ static void sprintf_disk_child(char *buf
23 -static char *is_there_reiserfs_struct(char *fmt, int *what, int *skip)
24 +static char *is_there_reiserfs_struct(char *fmt, int *what)
30 while ((k = strchr(k, '%')) != NULL) {
31 if (k[1] == 'k' || k[1] == 'K' || k[1] == 'h' || k[1] == 't' ||
32 k[1] == 'z' || k[1] == 'b' || k[1] == 'y' || k[1] == 'a') {
40 @@ -193,18 +190,15 @@ static void prepare_error_buf(const char
44 - int i, j, what, skip;
49 - while ((k = is_there_reiserfs_struct(fmt1, &what, &skip)) != NULL) {
50 + while ((k = is_there_reiserfs_struct(fmt1, &what)) != NULL) {
53 p += vsprintf(p, fmt1, args);
55 - for (i = 0; i < skip; i++)
56 - j = va_arg(args, int);
60 sprintf_le_key(p, va_arg(args, struct reiserfs_key *));