update to 1.1.0 (RHEL-39976, RHEL-39467, RHEL-39465, RHEL-39463, RHEL-39454)

Resolves: RHEL-39976, RHEL-39467, RHEL-39465, RHEL-39463, RHEL-39454
This commit is contained in:
Miroslav Lichvar 2024-05-28 14:35:36 +02:00
parent cc340301a8
commit 7bf2457677
5 changed files with 95 additions and 55 deletions

2
.gitignore vendored
View File

@ -1 +1 @@
/synce4l-1.0.0.tar.gz
/synce4l-1.1.0.tar.gz

View File

@ -1 +1 @@
SHA512 (synce4l-1.0.0.tar.gz) = b97656a50ee4cabdaddde166c2b74b16ebca339defb69e265c5222198c6d469af4e30328c3af47dcbe916f8474f04369e49f5fe98feb509cf7bb41e69e5d429b
SHA512 (synce4l-1.1.0.tar.gz) = d13418f9d229d3b335cf60f4f7a00bb21850d17c3d4f6486e0e13ce7ce6e2435f697b08e69a33980561d34d403148fb40e648eceb2c0b56a5841366d200fd650

View File

@ -1,50 +0,0 @@
commit 11cc3508d4b7594e2a429000d162b3582d242c20
Author: Miroslav Lichvar <mlichvar@redhat.com>
Date: Mon Nov 6 14:10:42 2023 +0100
Fix printf formats for 32-bit archs
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
diff --git a/config.c b/config.c
index 56fcbbd..723ff84 100644
--- a/config.c
+++ b/config.c
@@ -21,6 +21,7 @@
*/
#include <ctype.h>
#include <float.h>
+#include <inttypes.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
@@ -767,7 +768,7 @@ config_get_u64(struct config *cfg, const char *section, const char *option)
pr_err("bug: config option %s type mismatch!", option);
exit(-1);
}
- pr_debug("config item %s.%s is %lu (0x%lx)", section, option,
+ pr_debug("config item %s.%s is %"PRIu64" (0x%"PRIx64")", section, option,
ci->val.u64, ci->val.u64);
return ci->val.u64;
}
diff --git a/nl_dpll.c b/nl_dpll.c
index f343de6..4dee01b 100644
--- a/nl_dpll.c
+++ b/nl_dpll.c
@@ -8,6 +8,7 @@
#include <netlink/genl/genl.h>
#include <netlink/genl/ctrl.h>
#include <linux/rtnetlink.h>
+#include <inttypes.h>
#include <errno.h>
#include "nl_dpll.h"
#include "print.h"
@@ -118,7 +119,7 @@ int nl_dpll_device_id_get(struct nl_sock *sk, struct sk_arg *arg,
pr_err("%s: failed to send request", __func__);
goto msg_free;
}
- pr_debug("DEVICE_ID_GET request sent dpll id: %lu %s, ret:%d",
+ pr_debug("DEVICE_ID_GET request sent dpll id: %"PRIu64" %s, ret:%d",
clock_id, module_name, ret);
arg->err = 0;

90
synce4l-ccwarns.patch Normal file
View File

@ -0,0 +1,90 @@
commit b8089eabc28d665cba462c29aabdb159f0f153a6
Author: Miroslav Lichvar <mlichvar@redhat.com>
Date: Tue May 28 13:38:13 2024 +0200
Fix more compiler warnings
Fix the following warnings observed when -O2 and -D_FORTIFY_SOURCE=2 are
added to CFLAGS.
synce_dev.c: In function rebuild_inputs_prio:
synce_dev.c:610:28: warning: best_c_idx may be used uninitialized [-Wmaybe-uninitialized]
610 | all[best_c_idx] = NULL;
| ^
synce_dev.c:582:39: note: best_c_idx was declared here
582 | int i = 0, prio_count = 0, j, best_c_idx, ret;
| ^~~~~~~~~~
synce_manager.c: In function synce_manager_server_thread:
synce_manager.c:260:9: warning: strncpy specified bound 108 equals destination size [-Wstringop-truncation]
260 | strncpy(server.sun_path, synce_clock_get_socket_path(clk),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
261 | sizeof(server.sun_path));
| ~~~~~~~~~~~~~~~~~~~~~~~~
synce_manager.c:343:20: warning: ret may be used uninitialized [-Wmaybe-uninitialized]
343 | if (!ret)
| ^
synce_manager.c:241:26: note: ret was declared here
241 | int tlv_num = 0, ret, i, resp_len, bytes_read;
| ^~~
synce_manager.c: In function synce_manager_server_thread:
synce_manager.c:346:25: warning: ignoring return value of write declared with attribute warn_unused_result [-Wunused-result]
346 | write(new_socket, response, resp_len);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
diff --git a/synce_dev.c b/synce_dev.c
index fc784ed..5e2bbb9 100644
--- a/synce_dev.c
+++ b/synce_dev.c
@@ -579,7 +579,7 @@ static bool source_invalid(struct synce_clock_source *c)
int rebuild_inputs_prio(struct synce_dev *dev)
{
struct synce_clock_source *c, *best_c, **all, **prioritized;
- int i = 0, prio_count = 0, j, best_c_idx, ret;
+ int i = 0, prio_count = 0, j, best_c_idx = 0, ret;
uint32_t prio;
all = calloc(dev->num_clock_sources, sizeof(*all));
diff --git a/synce_manager.c b/synce_manager.c
index b9ba08d..598ef7e 100644
--- a/synce_manager.c
+++ b/synce_manager.c
@@ -257,8 +257,8 @@ static void *synce_manager_server_thread(void *arg)
}
server.sun_family = AF_UNIX;
- strncpy(server.sun_path, synce_clock_get_socket_path(clk),
- sizeof(server.sun_path));
+ snprintf(server.sun_path, sizeof(server.sun_path), "%s",
+ synce_clock_get_socket_path(clk));
if (bind(server_fd, (struct sockaddr *)&server, sizeof(server)) < 0) {
pr_err("%s Bind failed", __func__);
@@ -289,10 +289,12 @@ static void *synce_manager_server_thread(void *arg)
bytes_read = recv(new_socket, command, MAX_COMMAND_SIZE, 0);
if (bytes_read <= 0) {
synce_manager_generate_err_tlv(&err_tlv, "NULL command");
+ ret = -1;
goto return_response;
} else if (bytes_read > MAX_COMMAND_SIZE) {
synce_manager_generate_err_tlv(&err_tlv,
"Command size exceeds MAX_COMMAND_SIZE");
+ ret = -1;
goto return_response;
}
ret = synce_manager_parse_input(command, bytes_read, &tlv_array,
@@ -340,8 +342,8 @@ return_response:
if (tlv_array)
free((void *)tlv_array);
- if (!ret)
- write(new_socket, response, resp_len);
+ if (!ret && write(new_socket, response, resp_len) != resp_len)
+ ret = -1;
close(new_socket);
}

View File

@ -1,5 +1,5 @@
Name: synce4l
Version: 1.0.0
Version: 1.1.0
Release: 2%{?dist}
Summary: SyncE implementation for Linux
@ -8,8 +8,8 @@ URL: https://github.com/intel/synce4l
Source0: https://github.com/intel/synce4l/archive/%{version}/synce4l-%{version}.tar.gz
Source1: synce4l.service
# Fix building on 32-bit archs
Patch1: synce4l-32bit.patch
# Fix compiler warnings to avoid build failures with -Werror
Patch1: synce4l-ccwarns.patch
BuildRequires: gcc make systemd
BuildRequires: libnl3-devel