[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Minios-devel] [UNIKRAFT PATCH] lib/ukdebug: Separate condition string from format in UK_ASSERT, UK_WARNIF



Whenever a condition expression for UK_ASSERT() and UK_WARNIF()
is not fulfilled, the macros stringify the condition and print
it with uk_printd(). Because this string was handed over with
the format, the modulo operator (%) in the expression causes
formatting errors.
This patch hands over this condition string as separate argument
which will not be processed by uk_printd().

Signed-off-by: Simon Kuenzer <simon.kuenzer@xxxxxxxxx>
---
 lib/ukdebug/include/uk/assert.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/ukdebug/include/uk/assert.h b/lib/ukdebug/include/uk/assert.h
index 70e9e72..8569cdc 100644
--- a/lib/ukdebug/include/uk/assert.h
+++ b/lib/ukdebug/include/uk/assert.h
@@ -48,7 +48,8 @@
 #define UK_ASSERT(x)                                                   \
        do {                                                            \
                if (unlikely(!(x))) {                                   \
-                       uk_printd(DLVL_CRIT, "Assertion failure: " STRINGIFY(x) 
"\n"); \
+                       uk_printd(DLVL_CRIT, "Assertion failure: %s\n", \
+                                 STRINGIFY(x));                        \
                        /* TODO: stack trace */                         \
                        ukplat_terminate(UKPLAT_CRASH);                 \
                }                                                       \
@@ -57,7 +58,8 @@
 #define UK_WARNIF(x)                                                   \
        do {                                                            \
                if (unlikely(x)) {                                      \
-                       uk_printd(DLVL_WARN, "Condition warning: " STRINGIFY(x) 
"\n"); \
+                       uk_printd(DLVL_WARN, "Condition warning: %s\n", \
+                                 STRINGIFY(x));                        \
                }                                                       \
        } while (0)
 
-- 
2.7.4


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.