summaryrefslogtreecommitdiffstats
path: root/meta/recipes-extended/mdadm/files/0002-mdadm-Specify-enough-length-when-write-to-buffer.patch
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2017-04-19 19:31:47 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-05-11 16:59:18 +0100
commit63bafcca5d4c0b5d6481f5f64fe2c9d1f3d9e6fe (patch)
tree7c49d7aae8d946b0ebbdb826a17538c2193782e0 /meta/recipes-extended/mdadm/files/0002-mdadm-Specify-enough-length-when-write-to-buffer.patch
parent7f5437ac91a66901d71828fe648a8a470af877a3 (diff)
downloadpoky-63bafcca5d4c0b5d6481f5f64fe2c9d1f3d9e6fe.tar.gz
mdadm: Backport and make fixes for building with gcc7
(From OE-Core rev: c901af4574693ede5f1dcbccccc7c5a820b3d659) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-extended/mdadm/files/0002-mdadm-Specify-enough-length-when-write-to-buffer.patch')
-rw-r--r--meta/recipes-extended/mdadm/files/0002-mdadm-Specify-enough-length-when-write-to-buffer.patch75
1 files changed, 75 insertions, 0 deletions
diff --git a/meta/recipes-extended/mdadm/files/0002-mdadm-Specify-enough-length-when-write-to-buffer.patch b/meta/recipes-extended/mdadm/files/0002-mdadm-Specify-enough-length-when-write-to-buffer.patch
new file mode 100644
index 0000000000..cbce053a3a
--- /dev/null
+++ b/meta/recipes-extended/mdadm/files/0002-mdadm-Specify-enough-length-when-write-to-buffer.patch
@@ -0,0 +1,75 @@
1From bb4df273041ba206008bdb0ada75ccd97c29f623 Mon Sep 17 00:00:00 2001
2From: Xiao Ni <xni@redhat.com>
3Date: Fri, 17 Mar 2017 19:55:43 +0800
4Subject: [PATCH 2/5] mdadm: Specify enough length when write to buffer
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9In Detail.c the buffer path in function Detail is defined as path[200],
10in fact the max lenth of content which needs to write to the buffer is
11287. Because the length of dname of struct dirent is 255.
12During building it reports error:
13error: ā€˜%sā€™ directive writing up to 255 bytes into a region of size 189
14[-Werror=format-overflow=]
15
16In function examine_super0 there is a buffer nb with length 5.
17But it need to show a int type argument. The lenght of max
18number of int is 10. So the buffer length should be 11.
19
20In human_size function the length of buf is 30. During building
21there is a error:
22output between 20 and 47 bytes into a destination of size 30.
23Change the length to 47.
24
25Signed-off-by: Xiao Ni <xni@redhat.com>
26Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
27---
28Upstream-Status: Backport
29 Detail.c | 2 +-
30 super0.c | 2 +-
31 util.c | 2 +-
32 3 files changed, 3 insertions(+), 3 deletions(-)
33
34diff --git a/Detail.c b/Detail.c
35index 509b0d4..cb33794 100644
36--- a/Detail.c
37+++ b/Detail.c
38@@ -575,7 +575,7 @@ This is pretty boring
39 printf(" Member Arrays :");
40
41 while (dir && (de = readdir(dir)) != NULL) {
42- char path[200];
43+ char path[287];
44 char vbuf[1024];
45 int nlen = strlen(sra->sys_name);
46 dev_t devid;
47diff --git a/super0.c b/super0.c
48index 938cfd9..f5b4507 100644
49--- a/super0.c
50+++ b/super0.c
51@@ -231,7 +231,7 @@ static void examine_super0(struct supertype *st, char *homehost)
52 d++) {
53 mdp_disk_t *dp;
54 char *dv;
55- char nb[5];
56+ char nb[11];
57 int wonly, failfast;
58 if (d>=0) dp = &sb->disks[d];
59 else dp = &sb->this_disk;
60diff --git a/util.c b/util.c
61index f100972..32bd909 100644
62--- a/util.c
63+++ b/util.c
64@@ -811,7 +811,7 @@ unsigned long calc_csum(void *super, int bytes)
65 #ifndef MDASSEMBLE
66 char *human_size(long long bytes)
67 {
68- static char buf[30];
69+ static char buf[47];
70
71 /* We convert bytes to either centi-M{ega,ibi}bytes or
72 * centi-G{igi,ibi}bytes, with appropriate rounding,
73--
742.12.2
75