hvmloader/smbios: Correctly count the number of tables written
authorAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 30 Aug 2013 08:40:29 +0000 (10:40 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 30 Aug 2013 08:40:29 +0000 (10:40 +0200)
Fixes regression indirectly introduced by c/s 4d23036e709627

That changeset added some smbios tables which were option based on the
toolstack providing appropriate xenstore keys.  The do_struct() macro would
unconditionally increment nr_structs, even if a table was not actually
written.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
tools/firmware/hvmloader/smbios.c

index 3d5dc51c80db46e75c91abd6f6a1314986bef92c..9f292ccd37c5069cf92eff8292bb2e8134f3ac22 100644 (file)
@@ -192,7 +192,8 @@ write_smbios_tables(void *ep, void *start,
 
 #define do_struct(fn) do {                      \
     q = (fn);                                   \
-    (*nr_structs)++;                            \
+    if ( q != p )                               \
+        (*nr_structs)++;                        \
     if ( (q - p) > *max_struct_size )           \
         *max_struct_size = q - p;               \
     p = q;                                      \