systemd-248-3

Resolves: #1931710
This commit is contained in:
Lukas Nykryn 2021-05-14 12:07:08 +02:00
parent aae6677197
commit 7b725611af
3 changed files with 88 additions and 1 deletions

View File

@ -0,0 +1,53 @@
From 01095757986d9c93151cab01bb39d888c2094a78 Mon Sep 17 00:00:00 2001
From: Michal Sekletar <msekleta@redhat.com>
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 <linux/rfkill.h>.
#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);

View File

@ -0,0 +1,30 @@
From 54f0c86b083a4782e37754d3bbe27d4d81c53d23 Mon Sep 17 00:00:00 2001
From: Michal Sekletar <msekleta@redhat.com>
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);

View File

@ -21,7 +21,7 @@
Name: systemd Name: systemd
Url: https://www.freedesktop.org/wiki/Software/systemd Url: https://www.freedesktop.org/wiki/Software/systemd
Version: 248 Version: 248
Release: 2%{?dist} Release: 3%{?dist}
# For a breakdown of the licensing, see README # For a breakdown of the licensing, see README
License: LGPLv2+ and MIT and GPLv2+ License: LGPLv2+ and MIT and GPLv2+
Summary: System and Service Manager 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 %files standalone-sysusers -f .file-list-standalone-sysusers
%changelog %changelog
* Fri May 14 2021 systemd maintenance team <systemd-maint@redhat.com> - 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 <mboddu@redhat.com> * Fri Apr 16 2021 Mohan Boddu <mboddu@redhat.com>
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937 - Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937