]> code.ossystems Code Review - openembedded-core.git/commitdiff
mdadm: fix gcc-8 format-truncation warning
authorHongxu Jia <hongxu.jia@windriver.com>
Fri, 14 Dec 2018 07:29:56 +0000 (15:29 +0800)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 11 Jan 2019 10:38:21 +0000 (10:38 +0000)
While compiling with `-Werror=format-truncation=', it failed
[snip]
|super0.c:236:32: error: 'snprintf' output may be truncated
before the last format character [-Werror=format-truncation=]
|   snprintf(nb, sizeof(nb), "%4d", d);
|                                ^
|super0.c:236:3: note: 'snprintf' output between 5 and 12 bytes
into a destination of size 11
|   snprintf(nb, sizeof(nb), "%4d", d);
[snip]

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
meta/recipes-extended/mdadm/files/0001-fix-gcc-8-format-truncation-warning.patch [new file with mode: 0644]
meta/recipes-extended/mdadm/mdadm_4.1.bb

diff --git a/meta/recipes-extended/mdadm/files/0001-fix-gcc-8-format-truncation-warning.patch b/meta/recipes-extended/mdadm/files/0001-fix-gcc-8-format-truncation-warning.patch
new file mode 100644 (file)
index 0000000..fa9c8cc
--- /dev/null
@@ -0,0 +1,39 @@
+From 3158d3788c2e0fb75ace2c89840bd8a977fb4cb0 Mon Sep 17 00:00:00 2001
+From: Hongxu Jia <hongxu.jia@windriver.com>
+Date: Fri, 14 Dec 2018 15:12:31 +0800
+Subject: [PATCH] fix gcc-8 format-truncation warning
+
+While compiling with `-Werror=format-truncation=', it failed
+[snip]
+|super0.c:236:32: error: 'snprintf' output may be truncated
+before the last format character [-Werror=format-truncation=]
+|   snprintf(nb, sizeof(nb), "%4d", d);
+|                                ^
+|super0.c:236:3: note: 'snprintf' output between 5 and 12 bytes
+into a destination of size 11
+|   snprintf(nb, sizeof(nb), "%4d", d);
+[snip]
+
+Upstream-Status: Submitted [https://github.com/neilbrown/mdadm/pull/34]
+
+Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
+---
+ super0.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/super0.c b/super0.c
+index 756cab5..12c28da 100644
+--- a/super0.c
++++ b/super0.c
+@@ -229,7 +229,7 @@ static void examine_super0(struct supertype *st, char *homehost)
+            d++) {
+               mdp_disk_t *dp;
+               char *dv;
+-              char nb[11];
++              char nb[12];
+               int wonly, failfast;
+               if (d>=0) dp = &sb->disks[d];
+               else dp = &sb->this_disk;
+-- 
+2.7.4
+
index 9118baaf1a359194b5240a3160aae5594af63adf..7663a6b7ec20fc57e2ad74cc8b2536b3ec43733e 100644 (file)
@@ -16,6 +16,7 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/utils/raid/mdadm/${BPN}-${PV}.tar.xz \
            file://0001-Fix-the-path-of-corosync-and-dlm-header-files-check.patch \
            file://0001-Use-CC-to-check-for-implicit-fallthrough-warning-sup.patch \
            file://0001-Compute-abs-diff-in-a-standard-compliant-way.patch \
+           file://0001-fix-gcc-8-format-truncation-warning.patch \
            "
 SRC_URI[md5sum] = "51bf3651bd73a06c413a2f964f299598"
 SRC_URI[sha256sum] = "ab7688842908d3583a704d491956f31324c3a5fc9f6a04653cb75d19f1934f4a"