From 44e3f1cc351b6097d8a6251bc8bf8468247b98b7 Mon Sep 17 00:00:00 2001
From: Daan De Meyer <daan.j.demeyer@gmail.com>
Date: Tue, 1 Oct 2024 09:28:42 +0200
Subject: [PATCH 0902/1160] tree-wide: Fix Wformat warnings

The latest clang has started catching more integer promotions which
cause us to pass the wrong type to printf() format specifiers so let's
fix those.

(cherry picked from commit c73d14c43e7998ca54011875ad25afc634d57498)
(cherry picked from commit e129e3a8618b1b56f70978cb1db1d66a0fdcd573)
---
 src/pcrlock/pcrlock-firmware.c         | 2 +-
 src/udev/cdrom_id/cdrom_id.c           | 2 +-
 src/udev/dmi_memory_id/dmi_memory_id.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/pcrlock/pcrlock-firmware.c b/src/pcrlock/pcrlock-firmware.c
index 6fd7363144..059c87c622 100644
--- a/src/pcrlock/pcrlock-firmware.c
+++ b/src/pcrlock/pcrlock-firmware.c
@@ -128,7 +128,7 @@ int validate_firmware_header(
 
         log_debug("TPM PC Client Platform Firmware Profile: family %u.%u, revision %u.%u",
                   id->specVersionMajor, id->specVersionMinor,
-                  id->specErrata / 100, id->specErrata % 100);
+                  id->specErrata / 100U, id->specErrata % 100U);
 
         if (h->eventDataSize < (uint64_t) offsetof(TCG_EfiSpecIDEvent, digestSizes) + (uint64_t) (id->numberOfAlgorithms * sizeof(TCG_EfiSpecIdEventAlgorithmSize)) + 1U)
                 return log_error_errno(SYNTHETIC_ERRNO(EBADMSG), "Event log header doesn't fit all algorithms.");
diff --git a/src/udev/cdrom_id/cdrom_id.c b/src/udev/cdrom_id/cdrom_id.c
index 9285dd81f0..3a57ca0fd6 100644
--- a/src/udev/cdrom_id/cdrom_id.c
+++ b/src/udev/cdrom_id/cdrom_id.c
@@ -477,7 +477,7 @@ static int cd_profiles(Context *c) {
 
                 switch (feature) {
                 case 0x00:
-                        log_debug("GET CONFIGURATION: feature 'profiles', with %u entries", features[i + 3] / 4);
+                        log_debug("GET CONFIGURATION: feature 'profiles', with %u entries", features[i + 3] / 4U);
                         feature_profiles(c, features + i + 4, MIN(features[i + 3], len - i - 4));
                         break;
                 default:
diff --git a/src/udev/dmi_memory_id/dmi_memory_id.c b/src/udev/dmi_memory_id/dmi_memory_id.c
index 3f89cc7424..52ea250af8 100644
--- a/src/udev/dmi_memory_id/dmi_memory_id.c
+++ b/src/udev/dmi_memory_id/dmi_memory_id.c
@@ -399,7 +399,7 @@ static void dmi_memory_device_manufacturer_id(
         /* LSB is 7-bit Odd Parity number of continuation codes */
         if (code != 0)
                 printf("MEMORY_DEVICE_%u_%s=Bank %d, Hex 0x%02X\n", slot_num, attr_suffix,
-                       (code & 0x7F) + 1, code >> 8);
+                       (code & 0x7F) + 1, (uint16_t) (code >> 8));
 }
 
 static void dmi_memory_device_product_id(
-- 
2.33.0