diff options
author | Bertrand Marquis <bertrand.marquis@arm.com> | 2020-11-09 14:49:27 +0000 |
---|---|---|
committer | Bruce Ashfield <bruce.ashfield@gmail.com> | 2020-11-14 22:59:03 -0500 |
commit | f7687c8b22a45c0138f1293f17522e5cef121914 (patch) | |
tree | d1eaf7521d372e7d4b1b47fb2e615838c6b62382 | |
parent | 17660b5e8f33c512907480d413adad35fa50fb9d (diff) | |
download | meta-virtualization-f7687c8b22a45c0138f1293f17522e5cef121914.tar.gz |
xen: Fix xenpmd compilation error on arm32
Add patch merged in current Xen master to solve compilation errors on
xenmpd when Xen is compiled for arm32.
Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
Change-Id: Ifd94aa30e1b3a1016156ead395688f594ad2711d
Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
-rw-r--r-- | recipes-extended/xen/files/0001-tools-xenpmd-Fix-gcc10-snprintf-warning.patch | 60 | ||||
-rw-r--r-- | recipes-extended/xen/xen-tools_4.14.bb | 1 | ||||
-rw-r--r-- | recipes-extended/xen/xen-tools_git.bb | 1 |
3 files changed, 62 insertions, 0 deletions
diff --git a/recipes-extended/xen/files/0001-tools-xenpmd-Fix-gcc10-snprintf-warning.patch b/recipes-extended/xen/files/0001-tools-xenpmd-Fix-gcc10-snprintf-warning.patch new file mode 100644 index 00000000..0a136c90 --- /dev/null +++ b/recipes-extended/xen/files/0001-tools-xenpmd-Fix-gcc10-snprintf-warning.patch | |||
@@ -0,0 +1,60 @@ | |||
1 | From 0dfddb2116e3757f77a691a3fe335173088d69dc Mon Sep 17 00:00:00 2001 | ||
2 | Message-Id: <0dfddb2116e3757f77a691a3fe335173088d69dc.1604734077.git.bertrand.marquis@arm.com> | ||
3 | From: Bertrand Marquis <bertrand.marquis@arm.com> | ||
4 | Date: Thu, 15 Oct 2020 10:16:09 +0100 | ||
5 | Subject: [PATCH] tools/xenpmd: Fix gcc10 snprintf warning | ||
6 | |||
7 | Add a check for snprintf return code and ignore the entry if we get an | ||
8 | error. This should in fact never happen and is more a trick to make gcc | ||
9 | happy and prevent compilation errors. | ||
10 | |||
11 | This is solving the following gcc warning when compiling for arm32 host | ||
12 | platforms with optimization activated: | ||
13 | xenpmd.c:92:37: error: '%s' directive output may be truncated writing | ||
14 | between 4 and 2147483645 bytes into a region of size 271 | ||
15 | [-Werror=format-truncation=] | ||
16 | |||
17 | This is also solving the following Debian bug: | ||
18 | https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=970802 | ||
19 | |||
20 | Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com> | ||
21 | Acked-by: Wei Liu <wl@xen.org> | ||
22 | --- | ||
23 | Upstream-status: Backport from 4.15 | ||
24 | --- | ||
25 | tools/xenpmd/xenpmd.c | 9 +++++++-- | ||
26 | 1 file changed, 7 insertions(+), 2 deletions(-) | ||
27 | |||
28 | diff --git a/tools/xenpmd/xenpmd.c b/tools/xenpmd/xenpmd.c | ||
29 | index 35fd1c931a..12b82cf43e 100644 | ||
30 | --- a/tools/xenpmd/xenpmd.c | ||
31 | +++ b/tools/xenpmd/xenpmd.c | ||
32 | @@ -102,6 +102,7 @@ FILE *get_next_battery_file(DIR *battery_dir, | ||
33 | FILE *file = 0; | ||
34 | struct dirent *dir_entries; | ||
35 | char file_name[284]; | ||
36 | + int ret; | ||
37 | |||
38 | do | ||
39 | { | ||
40 | @@ -111,11 +112,15 @@ FILE *get_next_battery_file(DIR *battery_dir, | ||
41 | if ( strlen(dir_entries->d_name) < 4 ) | ||
42 | continue; | ||
43 | if ( battery_info_type == BIF ) | ||
44 | - snprintf(file_name, sizeof(file_name), BATTERY_INFO_FILE_PATH, | ||
45 | + ret = snprintf(file_name, sizeof(file_name), BATTERY_INFO_FILE_PATH, | ||
46 | dir_entries->d_name); | ||
47 | else | ||
48 | - snprintf(file_name, sizeof(file_name), BATTERY_STATE_FILE_PATH, | ||
49 | + ret = snprintf(file_name, sizeof(file_name), BATTERY_STATE_FILE_PATH, | ||
50 | dir_entries->d_name); | ||
51 | + /* This should not happen but is needed to pass gcc checks */ | ||
52 | + if (ret < 0) | ||
53 | + continue; | ||
54 | + file_name[sizeof(file_name) - 1] = '\0'; | ||
55 | file = fopen(file_name, "r"); | ||
56 | } while ( !file ); | ||
57 | |||
58 | -- | ||
59 | 2.17.1 | ||
60 | |||
diff --git a/recipes-extended/xen/xen-tools_4.14.bb b/recipes-extended/xen/xen-tools_4.14.bb index 4119190d..73a52bc5 100644 --- a/recipes-extended/xen/xen-tools_4.14.bb +++ b/recipes-extended/xen/xen-tools_4.14.bb | |||
@@ -7,6 +7,7 @@ SRC_URI = " \ | |||
7 | git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \ | 7 | git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \ |
8 | file://0001-python-pygrub-pass-DISTUTILS-xen-4.14.patch \ | 8 | file://0001-python-pygrub-pass-DISTUTILS-xen-4.14.patch \ |
9 | file://0001-xen-build-temporarily-inhibit-Werror-4.14.patch \ | 9 | file://0001-xen-build-temporarily-inhibit-Werror-4.14.patch \ |
10 | file://0001-tools-xenpmd-Fix-gcc10-snprintf-warning.patch \ | ||
10 | " | 11 | " |
11 | 12 | ||
12 | LIC_FILES_CHKSUM ?= "file://COPYING;md5=419739e325a50f3d7b4501338e44a4e5" | 13 | LIC_FILES_CHKSUM ?= "file://COPYING;md5=419739e325a50f3d7b4501338e44a4e5" |
diff --git a/recipes-extended/xen/xen-tools_git.bb b/recipes-extended/xen/xen-tools_git.bb index 71aeeed8..1f6be1d1 100644 --- a/recipes-extended/xen/xen-tools_git.bb +++ b/recipes-extended/xen/xen-tools_git.bb | |||
@@ -7,6 +7,7 @@ SRC_URI = " \ | |||
7 | git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \ | 7 | git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \ |
8 | file://0001-python-pygrub-pass-DISTUTILS-xen-4.14.patch \ | 8 | file://0001-python-pygrub-pass-DISTUTILS-xen-4.14.patch \ |
9 | file://0001-xen-build-temporarily-inhibit-Werror-4.14.patch \ | 9 | file://0001-xen-build-temporarily-inhibit-Werror-4.14.patch \ |
10 | file://0001-tools-xenpmd-Fix-gcc10-snprintf-warning.patch \ | ||
10 | " | 11 | " |
11 | 12 | ||
12 | LIC_FILES_CHKSUM ?= "file://COPYING;md5=419739e325a50f3d7b4501338e44a4e5" | 13 | LIC_FILES_CHKSUM ?= "file://COPYING;md5=419739e325a50f3d7b4501338e44a4e5" |