]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/reiserfs/prints.c
reiserfs: prepare_error_buf wrongly consumes va_arg
[linux-2.6-omap-h63xx.git] / fs / reiserfs / prints.c
index 535a3c7fc68ea99a7b5ea67c7c166a5064d2a60a..b87b23717c23115fb90be71a79501832ad7c4c32 100644 (file)
@@ -157,19 +157,16 @@ static void sprintf_disk_child(char *buf, struct disk_child *dc)
                dc_size(dc));
 }
 
-static char *is_there_reiserfs_struct(char *fmt, int *what, int *skip)
+static char *is_there_reiserfs_struct(char *fmt, int *what)
 {
        char *k = fmt;
 
-       *skip = 0;
-
        while ((k = strchr(k, '%')) != NULL) {
                if (k[1] == 'k' || k[1] == 'K' || k[1] == 'h' || k[1] == 't' ||
                    k[1] == 'z' || k[1] == 'b' || k[1] == 'y' || k[1] == 'a') {
                        *what = k[1];
                        break;
                }
-               (*skip)++;
                k++;
        }
        return k;
@@ -193,18 +190,15 @@ static void prepare_error_buf(const char *fmt, va_list args)
        char *fmt1 = fmt_buf;
        char *k;
        char *p = error_buf;
-       int i, j, what, skip;
+       int what;
 
        strcpy(fmt1, fmt);
 
-       while ((k = is_there_reiserfs_struct(fmt1, &what, &skip)) != NULL) {
+       while ((k = is_there_reiserfs_struct(fmt1, &what)) != NULL) {
                *k = 0;
 
                p += vsprintf(p, fmt1, args);
 
-               for (i = 0; i < skip; i++)
-                       j = va_arg(args, int);
-
                switch (what) {
                case 'k':
                        sprintf_le_key(p, va_arg(args, struct reiserfs_key *));
@@ -264,14 +258,17 @@ static void prepare_error_buf(const char *fmt, va_list args)
     va_end( args );\
 }
 
-void reiserfs_warning(struct super_block *sb, const char *fmt, ...)
+void __reiserfs_warning(struct super_block *sb, const char *id,
+                        const char *function, const char *fmt, ...)
 {
        do_reiserfs_warning(fmt);
        if (sb)
-               printk(KERN_WARNING "REISERFS warning (device %s): %s\n",
-                      sb->s_id, error_buf);
+               printk(KERN_WARNING "REISERFS warning (device %s): %s%s%s: "
+                      "%s\n", sb->s_id, id ? id : "", id ? " " : "",
+                      function, error_buf);
        else
-               printk(KERN_WARNING "REISERFS warning: %s\n", error_buf);
+               printk(KERN_WARNING "REISERFS warning: %s%s%s: %s\n",
+                      id ? id : "", id ? " " : "", function, error_buf);
 }
 
 /* No newline.. reiserfs_info calls can be followed by printk's */