diff options
author | Khem Raj <raj.khem@gmail.com> | 2017-04-19 19:31:47 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-05-11 16:59:18 +0100 |
commit | 63bafcca5d4c0b5d6481f5f64fe2c9d1f3d9e6fe (patch) | |
tree | 7c49d7aae8d946b0ebbdb826a17538c2193782e0 /meta/recipes-extended/mdadm/files/0002-mdadm-Specify-enough-length-when-write-to-buffer.patch | |
parent | 7f5437ac91a66901d71828fe648a8a470af877a3 (diff) | |
download | poky-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.patch | 75 |
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 @@ | |||
1 | From bb4df273041ba206008bdb0ada75ccd97c29f623 Mon Sep 17 00:00:00 2001 | ||
2 | From: Xiao Ni <xni@redhat.com> | ||
3 | Date: Fri, 17 Mar 2017 19:55:43 +0800 | ||
4 | Subject: [PATCH 2/5] mdadm: Specify enough length when write to buffer | ||
5 | MIME-Version: 1.0 | ||
6 | Content-Type: text/plain; charset=UTF-8 | ||
7 | Content-Transfer-Encoding: 8bit | ||
8 | |||
9 | In Detail.c the buffer path in function Detail is defined as path[200], | ||
10 | in fact the max lenth of content which needs to write to the buffer is | ||
11 | 287. Because the length of dname of struct dirent is 255. | ||
12 | During building it reports error: | ||
13 | error: ā%sā directive writing up to 255 bytes into a region of size 189 | ||
14 | [-Werror=format-overflow=] | ||
15 | |||
16 | In function examine_super0 there is a buffer nb with length 5. | ||
17 | But it need to show a int type argument. The lenght of max | ||
18 | number of int is 10. So the buffer length should be 11. | ||
19 | |||
20 | In human_size function the length of buf is 30. During building | ||
21 | there is a error: | ||
22 | output between 20 and 47 bytes into a destination of size 30. | ||
23 | Change the length to 47. | ||
24 | |||
25 | Signed-off-by: Xiao Ni <xni@redhat.com> | ||
26 | Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com> | ||
27 | --- | ||
28 | Upstream-Status: Backport | ||
29 | Detail.c | 2 +- | ||
30 | super0.c | 2 +- | ||
31 | util.c | 2 +- | ||
32 | 3 files changed, 3 insertions(+), 3 deletions(-) | ||
33 | |||
34 | diff --git a/Detail.c b/Detail.c | ||
35 | index 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; | ||
47 | diff --git a/super0.c b/super0.c | ||
48 | index 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; | ||
60 | diff --git a/util.c b/util.c | ||
61 | index 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 | -- | ||
74 | 2.12.2 | ||
75 | |||