summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta-oe/recipes-bsp/ledmon/ledmon/Correct-get_uint64.patch44
-rw-r--r--meta-oe/recipes-bsp/ledmon/ledmon_0.97.bb3
2 files changed, 46 insertions, 1 deletions
diff --git a/meta-oe/recipes-bsp/ledmon/ledmon/Correct-get_uint64.patch b/meta-oe/recipes-bsp/ledmon/ledmon/Correct-get_uint64.patch
new file mode 100644
index 0000000000..c4d8ff80b8
--- /dev/null
+++ b/meta-oe/recipes-bsp/ledmon/ledmon/Correct-get_uint64.patch
@@ -0,0 +1,44 @@
1From ed747ac3540cb38797f56533f9f51f5627e6b994 Mon Sep 17 00:00:00 2001
2From: Tony Asleson <tasleson@redhat.com>
3Date: Wed, 21 Aug 2024 12:27:28 -0500
4Subject: [PATCH] Correct get_uint64
5
6For large integer values, the existing implementation will be
7incorrect.
8
9The current implementation of converting strings to integer values
10uses a signed integer for the intermediate conversion and performs
11a range check. Since any value in an unsigned 64-bit integer is valid,
12the range check seems unnecessary. To mimic the same code path, we would
13need a larger integer type.
14
15Signed-off-by: Tony Asleson <tasleson@redhat.com>
16
17Upstream-Status: Backport [https://github.com/intel/ledmon/commit/ed747ac3540cb38797f56533f9f51f5627e6b994]
18
19Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
20---
21 src/utils.c | 9 ++++++--
22 1 file changed, 7 insertions(+), 2 deletions(-)
23
24diff --git a/src/utils.c b/src/utils.c
25index 86b9593..b87d064 100644
26--- a/src/utils.c
27+++ b/src/utils.c
28@@ -102,9 +102,14 @@ uint64_t get_uint64(const char *path, uint64_t defval, const char *name)
29 if (!p)
30 return defval;
31
32- str_toul(&defval, p, NULL, 16);
33+ errno = 0;
34+ uint64_t t = strtoull(p, NULL, 16);
35 free(p);
36- return defval;
37+
38+ if (errno)
39+ return defval;
40+
41+ return t;
42 }
43
44 int get_int(const char *path, int defval, const char *name)
diff --git a/meta-oe/recipes-bsp/ledmon/ledmon_0.97.bb b/meta-oe/recipes-bsp/ledmon/ledmon_0.97.bb
index 88a6e5bb30..23a49a7d1b 100644
--- a/meta-oe/recipes-bsp/ledmon/ledmon_0.97.bb
+++ b/meta-oe/recipes-bsp/ledmon/ledmon_0.97.bb
@@ -16,7 +16,8 @@ SYSTEMD_SERVICE:${PN} = "ledmon.service"
16 16
17SRC_URI = "git://github.com/intel/ledmon;branch=master;protocol=https \ 17SRC_URI = "git://github.com/intel/ledmon;branch=master;protocol=https \
18 file://0002-include-sys-select.h-and-sys-types.h.patch \ 18 file://0002-include-sys-select.h-and-sys-types.h.patch \
19 file://0001-fix-build-with-clang.patch" 19 file://0001-fix-build-with-clang.patch \
20 file://Correct-get_uint64.patch"
20 21
21SRCREV = "b0edae14e8660b80ffe0384354038a9f62e2978d" 22SRCREV = "b0edae14e8660b80ffe0384354038a9f62e2978d"
22 23