diff --git a/0001-rfkill-don-t-compare-values-of-different-signedness.patch b/0001-rfkill-don-t-compare-values-of-different-signedness.patch new file mode 100644 index 0000000..b534b07 --- /dev/null +++ b/0001-rfkill-don-t-compare-values-of-different-signedness.patch @@ -0,0 +1,53 @@ +From 01095757986d9c93151cab01bb39d888c2094a78 Mon Sep 17 00:00:00 2001 +From: Michal Sekletar +Date: Thu, 13 May 2021 10:52:42 +0200 +Subject: [PATCH] rfkill: don't compare values of different signedness +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +RFKILL_EVENT_SIZE_V1 is defined as follows in . + + #define RFKILL_EVENT_SIZE_V1 sizeof(struct rfkill_event) + +Avoid warning by casting l to size_t. In both cases we are guaranteed that l can't +be negative hence casting to size_t is fine to do. + +../src/rfkill/rfkill.c: In function ‘load_state’: +../src/rfkill/rfkill.c:180:15: warning: comparison of integer expressions of different signedness: ‘ssize_t’ {aka ‘long int’} and ‘long unsigned int’ [-Wsign-compare] + 180 | if (l < RFKILL_EVENT_SIZE_V1) + | ^ + +../src/rfkill/rfkill.c: In function ‘run’: ../src/rfkill/rfkill.c:338:23: warning: comparison of integer expressions of different signedness: ‘ssize_t’ {aka ‘long int’} and ‘long unsigned int’ [-Wsign-compare] + 338 | if (l < RFKILL_EVENT_SIZE_V1) + | ^ + +gcc-11.0.1-0.3.1.el9.x86_64 + +Related: #1931710 +--- + src/rfkill/rfkill.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/rfkill/rfkill.c b/src/rfkill/rfkill.c +index e2d1a1be5f..6126e9b0c4 100644 +--- a/src/rfkill/rfkill.c ++++ b/src/rfkill/rfkill.c +@@ -177,7 +177,7 @@ static int load_state(Context *c, const struct rfkill_event *event) { + ssize_t l = write(c->rfkill_fd, &we, sizeof we); + if (l < 0) + return log_error_errno(errno, "Failed to restore rfkill state for %i: %m", event->idx); +- if (l < RFKILL_EVENT_SIZE_V1) ++ if ((size_t) l < RFKILL_EVENT_SIZE_V1) + return log_error_errno(SYNTHETIC_ERRNO(EIO), + "Couldn't write rfkill event structure, too short (wrote %zd of %zu bytes).", + l, sizeof we); +@@ -335,7 +335,7 @@ static int run(int argc, char *argv[]) { + break; + } + +- if (l < RFKILL_EVENT_SIZE_V1) ++ if ((size_t) l < RFKILL_EVENT_SIZE_V1) + return log_error_errno(SYNTHETIC_ERRNO(EIO), "Short read of struct rfkill_event: (%zd < %d)", + l, RFKILL_EVENT_SIZE_V1); + log_debug("Reading struct rfkill_event: got %zd bytes.", l); diff --git a/0002-rfkill-fix-the-format-string-to-prevent-compilation-.patch b/0002-rfkill-fix-the-format-string-to-prevent-compilation-.patch new file mode 100644 index 0000000..4b01401 --- /dev/null +++ b/0002-rfkill-fix-the-format-string-to-prevent-compilation-.patch @@ -0,0 +1,30 @@ +From 54f0c86b083a4782e37754d3bbe27d4d81c53d23 Mon Sep 17 00:00:00 2001 +From: Michal Sekletar +Date: Thu, 13 May 2021 12:10:00 +0200 +Subject: [PATCH] rfkill: fix the format string to prevent compilation error +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +../src/rfkill/rfkill.c:339:70: error: format ‘%d’ expects argument of type ‘int’, but argument 8 has type ‘long unsigned int’ [-Werror=format=] + 339 | return log_error_errno(SYNTHETIC_ERRNO(EIO), "Short read of struct rfkill_event: (%zd < %d)", + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Resolves: #1931710 +--- + src/rfkill/rfkill.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/rfkill/rfkill.c b/src/rfkill/rfkill.c +index 6126e9b0c4..0b6ba65c3a 100644 +--- a/src/rfkill/rfkill.c ++++ b/src/rfkill/rfkill.c +@@ -336,7 +336,7 @@ static int run(int argc, char *argv[]) { + } + + if ((size_t) l < RFKILL_EVENT_SIZE_V1) +- return log_error_errno(SYNTHETIC_ERRNO(EIO), "Short read of struct rfkill_event: (%zd < %d)", ++ return log_error_errno(SYNTHETIC_ERRNO(EIO), "Short read of struct rfkill_event: (%zd < %lu)", + l, RFKILL_EVENT_SIZE_V1); + log_debug("Reading struct rfkill_event: got %zd bytes.", l); + diff --git a/systemd.spec b/systemd.spec index 3c7a90f..a1b794c 100644 --- a/systemd.spec +++ b/systemd.spec @@ -21,7 +21,7 @@ Name: systemd Url: https://www.freedesktop.org/wiki/Software/systemd Version: 248 -Release: 2%{?dist} +Release: 3%{?dist} # For a breakdown of the licensing, see README License: LGPLv2+ and MIT and GPLv2+ Summary: System and Service Manager @@ -901,6 +901,10 @@ getent passwd systemd-resolve &>/dev/null || useradd -r -u 193 -l -g systemd-res %files standalone-sysusers -f .file-list-standalone-sysusers %changelog +* Fri May 14 2021 systemd maintenance team - 248-3 +- rfkill: don't compare values of different signedness (#1931710) +- rfkill: fix the format string to prevent compilation error (#1931710) + * Fri Apr 16 2021 Mohan Boddu - Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937