Skip to contentSkip to conversation

x86/vpmu: Fix incorrect printk format specifiers

PATCH In review Alejandro Vallejo 2 participants 5 messages Sep 21

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/vpmu: Fix incorrect printk format specifiers

The patch in Fixes adjusted two vendor variables from uint8_t and plain int to to unsigned int. But they were both used later in printks with the %d specifier rather than %u. Adjust accordingly.

Fixes 39a9a49449d7 ("x86: Remove x86 prefixed names from x86/cpu/ files")
---
 xen/arch/x86/cpu/vpmu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
xen/arch/x86/cpu/vpmu.c +2 -2
index 470f5ec98d..e0f7edded3 100644
@@ -417,7 +417,7 @@ static int vpmu_arch_initialise(struct vcpu *v)
     {
         if ( vpmu_mode != XENPMU_MODE_OFF )
         {
-            printk(XENLOG_G_WARNING "VPMU: Unknown CPU vendor %d. "
+            printk(XENLOG_G_WARNING "VPMU: Unknown CPU vendor %u. "
                    "Disabling VPMU\n", vendor);
             opt_vpmu_enabled = 0;
             vpmu_mode = XENPMU_MODE_OFF;
@@ -849,7 +849,7 @@ static int __init cf_check vpmu_init(void)
 #endif
 
     default:
-        printk(XENLOG_WARNING "VPMU: Unknown CPU vendor: %d. "
+        printk(XENLOG_WARNING "VPMU: Unknown CPU vendor: %u. "
                "Turning VPMU off.\n", vendor);
         break;
     }

base-commit: adbbbd47a1fad8e3bc1ab65c555f11d831fd6681

Signature · 1 line
2.43.0
#1 lore raw
Quoted 6 lines · Alejandro Vallejo

The patch in Fixes adjusted two vendor variables from uint8_t and plain int to to unsigned int. But they were both used later in printks with the %d specifier rather than %u. Adjust accordingly.

Fixes 39a9a49449d7 ("x86: Remove x86 prefixed names from x86/cpu/ files")

If this is going to be a problem, then shouldn't we turn -Wformat-signedness on?

For the patch, Acked-by: Andrew Cooper <[email protected]>

#2 lore raw
Quoted 10 lines · Andrew Cooper
Quoted 6 lines · Alejandro Vallejo

The patch in Fixes adjusted two vendor variables from uint8_t and plain int to to unsigned int. But they were both used later in printks with the %d specifier rather than %u. Adjust accordingly.

Fixes 39a9a49449d7 ("x86: Remove x86 prefixed names from x86/cpu/ files")

If this is going to be a problem, then shouldn't we turn -Wformat-signedness on?

I tried that before sending, but that needs a whole new series. Things are not quite as clean as I'd hope.

Quoted 2 lines

For the patch, Acked-by: Andrew Cooper <[email protected]>

Thanks

Alejandro

#3 lore raw
Quoted 6 lines · Alejandro Vallejo
Quoted 5 lines · Andrew Cooper
Quoted 4 lines · Alejandro Vallejo

The patch in Fixes adjusted two vendor variables from uint8_t and plain int to to unsigned int. But they were both used later in printks with the %d specifier rather than %u. Adjust accordingly.

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
Fixes 39a9a49449d7 ("x86: Remove x86 prefixed names from x86/cpu/ files")

If this is going to be a problem, then shouldn't we turn -Wformat-signedness on?

I tried that before sending, but that needs a whole new series. Things are not quite as clean as I'd hope.

Well, it's going to keep on regressing until -Wformat-signedness is in place.

~Andrew

#4 lore raw
Quoted 11 lines · Andrew Cooper
Quoted 10 lines · Alejandro Vallejo
Quoted 9 lines · Andrew Cooper
Quoted 6 lines · Alejandro Vallejo

The patch in Fixes adjusted two vendor variables from uint8_t and plain int to to unsigned int. But they were both used later in printks with the %d specifier rather than %u. Adjust accordingly.

Fixes 39a9a49449d7 ("x86: Remove x86 prefixed names from x86/cpu/ files")

If this is going to be a problem, then shouldn't we turn -Wformat-signedness on?

Quoted 7 lines
Quoted 2 lines

I tried that before sending, but that needs a whole new series. Things are not quite as clean as I'd hope.

Well, it's going to keep on regressing until -Wformat-signedness is in place.

~Andrew

In case it wasn't obvious, I agree. I just happened to bump into these while refactoring that general area for another series and I'd rather fix them separately rather than bundling it in a 15+ patch series.

In due course it shall be done.

Cheers,
Alejandro