aboutsummaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorRicardo M. Correia <[email protected]>2010-07-20 13:51:42 -0700
committerBrian Behlendorf <[email protected]>2010-07-20 13:51:46 -0700
commit2c762de8303e441154a0c38c0cf78170b5d45013 (patch)
tree333f5404539867b0e47a73d07e4c0fda480e59e2 /module
parent9dd5d138b2326201f4258b126f2bfdb0b4c6138d (diff)
Fix buggy kmem_{v}asprintf() functions
When the kvasprintf() call fails they should reset the arguments by calling va_start()/va_copy() and va_end() inside the loop, otherwise they'll try to read more arguments rather than starting over and reading them from the beginning. Signed-off-by: Ricardo M. Correia <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]>
Diffstat (limited to 'module')
-rw-r--r--module/spl/spl-kmem.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/module/spl/spl-kmem.c b/module/spl/spl-kmem.c
index 100c60230..e575b1ee9 100644
--- a/module/spl/spl-kmem.c
+++ b/module/spl/spl-kmem.c
@@ -245,11 +245,11 @@ kmem_vasprintf(const char *fmt, va_list ap)
va_list aq;
char *ptr;
- va_copy(aq, ap);
do {
+ va_copy(aq, ap);
ptr = kvasprintf(GFP_KERNEL, fmt, aq);
+ va_end(aq);
} while (ptr == NULL);
- va_end(aq);
return ptr;
}
@@ -261,11 +261,11 @@ kmem_asprintf(const char *fmt, ...)
va_list ap;
char *ptr;
- va_start(ap, fmt);
do {
+ va_start(ap, fmt);
ptr = kvasprintf(GFP_KERNEL, fmt, ap);
+ va_end(ap);
} while (ptr == NULL);
- va_end(ap);
return ptr;
}