Skip to contentSkip to conversation

xen/lib: Annotate debugtrace_printk() with a printf compiler __attribute__

PATCH In review Andrew Cooper 2 participants 2 messages Jul 25, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen/lib: Annotate debugtrace_printk() with a printf compiler __attribute__

And fix up the resulting compilation issue.

CC Jan Beulich <[email protected]>
CC Tim Deegan <[email protected]>
---
 xen/arch/x86/mm/p2m.c |    2 +-
 xen/include/xen/lib.h |    3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)
xen/arch/x86/mm/p2m.c +1 -1
index 2c7bc0f..bca9f0f 100644
@@ -1807,7 +1807,7 @@ void audit_p2m(struct domain *d,
  
     P2M_PRINTK("p2m audit complete\n");
     if ( orphans_count | mpbad | pmbad )
-        P2M_PRINTK("p2m audit found %lu orphans\n", orphans);
+        P2M_PRINTK("p2m audit found %lu orphans\n", orphans_count);
     if ( mpbad | pmbad )
     {
         P2M_PRINTK("p2m audit found %lu odd p2m, %lu bad m2p entries\n",
xen/include/xen/lib.h +2 -1
index e81b80e..f11b49e 100644
@@ -75,7 +75,8 @@ int parse_bool(const char *s);
 /*#define DEBUG_TRACE_DUMP*/
 #ifdef DEBUG_TRACE_DUMP
 extern void debugtrace_dump(void);
-extern void debugtrace_printk(const char *fmt, ...);
+extern void debugtrace_printk(const char *fmt, ...)
+    __attribute__ ((format (printf, 1, 2)));
 #else
 #define debugtrace_dump()          ((void)0)
 #define debugtrace_printk(_f, ...) ((void)0)
Signature · 1 line
1.7.10.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines
Quoted 1 line
Quoted 1 line · On 25.07.14 at 15:11, <[email protected]> wrote:

And fix up the resulting compilation issue.

with a question perhaps more to Tim than to you:

xen/arch/x86/mm/p2m.c void audit_p2m(struct domain *d, · line 1813

Quoted 11 lines
xen/arch/x86/mm/p2m.c +1 -1
@@ -1807,7 +1807,7 @@ void audit_p2m(struct domain *d,
 
     P2M_PRINTK("p2m audit complete\n");
     if ( orphans_count | mpbad | pmbad )
-        P2M_PRINTK("p2m audit found %lu orphans\n", orphans);
+        P2M_PRINTK("p2m audit found %lu orphans\n", orphans_count);
     if ( mpbad | pmbad )
     {
         P2M_PRINTK("p2m audit found %lu odd p2m, %lu bad m2p entries\n",

Seeing both of the if() conditions - is the first one really usefully or-ing in mpbad and pmbad?

Jan