diff options
author | Gyorgy Sarvari <skandigraun@gmail.com> | 2025-09-13 11:49:20 +0200 |
---|---|---|
committer | Gyorgy Sarvari <skandigraun@gmail.com> | 2025-09-14 16:50:04 +0200 |
commit | cecc91c084c95cedc210ddd0ca6b36ea6c520a80 (patch) | |
tree | bd9ac16852a27f6c6b0be9fbe27f98d0a53e2f19 | |
parent | eabddce219d0b1f837c5ea446e2710775f7d4d0e (diff) | |
download | meta-openembedded-cecc91c084c95cedc210ddd0ca6b36ea6c520a80.tar.gz |
ledmon: fix building on 32-bit x86
Building the recipe on x86 platform fails with the following error:
| ../../git/src/utils.c: In function 'get_uint64':
| ../../git/src/utils.c:105:18: error: passing argument 1 of 'str_toul' from incompatible pointer type [-Wincompatible-pointer-types]
| 105 | str_toul(&defval, p, NULL, 16);
Upstream has already changed this function to avoid overflow due to the
size difference in the pointer - this change backports that patch.
Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
-rw-r--r-- | meta-oe/recipes-bsp/ledmon/ledmon/Correct-get_uint64.patch | 44 | ||||
-rw-r--r-- | meta-oe/recipes-bsp/ledmon/ledmon_0.97.bb | 3 |
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 @@ | |||
1 | From ed747ac3540cb38797f56533f9f51f5627e6b994 Mon Sep 17 00:00:00 2001 | ||
2 | From: Tony Asleson <tasleson@redhat.com> | ||
3 | Date: Wed, 21 Aug 2024 12:27:28 -0500 | ||
4 | Subject: [PATCH] Correct get_uint64 | ||
5 | |||
6 | For large integer values, the existing implementation will be | ||
7 | incorrect. | ||
8 | |||
9 | The current implementation of converting strings to integer values | ||
10 | uses a signed integer for the intermediate conversion and performs | ||
11 | a range check. Since any value in an unsigned 64-bit integer is valid, | ||
12 | the range check seems unnecessary. To mimic the same code path, we would | ||
13 | need a larger integer type. | ||
14 | |||
15 | Signed-off-by: Tony Asleson <tasleson@redhat.com> | ||
16 | |||
17 | Upstream-Status: Backport [https://github.com/intel/ledmon/commit/ed747ac3540cb38797f56533f9f51f5627e6b994] | ||
18 | |||
19 | Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com> | ||
20 | --- | ||
21 | src/utils.c | 9 ++++++-- | ||
22 | 1 file changed, 7 insertions(+), 2 deletions(-) | ||
23 | |||
24 | diff --git a/src/utils.c b/src/utils.c | ||
25 | index 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 | ||
17 | SRC_URI = "git://github.com/intel/ledmon;branch=master;protocol=https \ | 17 | SRC_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 | ||
21 | SRCREV = "b0edae14e8660b80ffe0384354038a9f62e2978d" | 22 | SRCREV = "b0edae14e8660b80ffe0384354038a9f62e2978d" |
22 | 23 | ||