vsprintf: Make %pGp print the hex value
[linux-2.6-block.git] / lib / test_printf.c
index d09993fca46397c0008d00e284eec2d59a09c98c..07309c45f327965fdbaca087cd83c138a331a1d9 100644 (file)
@@ -609,10 +609,14 @@ page_flags_test(int section, int node, int zone, int last_cpupid,
                char *cmp_buf)
 {
        unsigned long values[] = {section, node, zone, last_cpupid, kasan_tag};
-       unsigned long size = 0;
+       unsigned long size;
        bool append = false;
        int i;
 
+       for (i = 0; i < ARRAY_SIZE(values); i++)
+               flags |= (values[i] & pft[i].mask) << pft[i].shift;
+
+       size = scnprintf(cmp_buf, BUF_SIZE, "%#lx(", flags);
        if (flags & PAGEFLAGS_MASK) {
                size += scnprintf(cmp_buf + size, BUF_SIZE - size, "%s", name);
                append = true;
@@ -625,7 +629,6 @@ page_flags_test(int section, int node, int zone, int last_cpupid,
                if (append)
                        size += scnprintf(cmp_buf + size, BUF_SIZE - size, "|");
 
-               flags |= (values[i] & pft[i].mask) << pft[i].shift;
                size += scnprintf(cmp_buf + size, BUF_SIZE - size, "%s=",
                                pft[i].name);
                size += scnprintf(cmp_buf + size, BUF_SIZE - size, pft[i].fmt,
@@ -633,6 +636,8 @@ page_flags_test(int section, int node, int zone, int last_cpupid,
                append = true;
        }
 
+       snprintf(cmp_buf + size, BUF_SIZE - size, ")");
+
        test(cmp_buf, "%pGp", &flags);
 }