summaryrefslogtreecommitdiffstats
path: root/meta/recipes-extended/mdadm/files/0001-Disable-gcc8-warnings.patch
blob: 361d53ca6c3f97216fc3b0a78c0ff540d1d2fedf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
From a6c991750ae6ebd87a0b9b243bec7fd8e5a064c5 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 9 May 2018 12:56:41 -0700
Subject: [PATCH] Disable gcc8 warnings

This is needed until
https://bugzilla.redhat.com/show_bug.cgi?id=1553958

Fix super0.c issue which is triggered only in DEBUG_BUILD with -O1 (or any
configuration without -ftree-vrp or with -fno-tree-vrp)

super0.c: In function 'examine_super0':
super0.c:238:32: error: 'snprintf' output may be truncated before the last format character [-Werror=format-truncation=]
   snprintf(nb, sizeof(nb), "%4d", d);
                                ^

Upstream-Status: Inappropriate [Workaround]

Signed-off-by: Khem Raj <raj.khem@gmail.com>

---
 Monitor.c     | 4 +++-
 mdopen.c      | 4 ++++
 super-ddf.c   | 4 ++++
 super-intel.c | 6 ++++++
 super0.c      | 2 +-
 super1.c      | 5 +++++
 6 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/Monitor.c b/Monitor.c
index 036103f..08cbd0a 100644
--- a/Monitor.c
+++ b/Monitor.c
@@ -445,7 +445,8 @@ static void alert(char *event, char *dev, char *disc, struct alert_info *info)
 			       event, dev);
 	}
 }
-
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wformat-truncation"
 static int check_array(struct state *st, struct mdstat_ent *mdstat,
 		       int test, struct alert_info *ainfo,
 		       int increments, char *prefer)
@@ -673,6 +674,7 @@ static int check_array(struct state *st, struct mdstat_ent *mdstat,
 	st->err++;
 	goto out;
 }
+#pragma GCC diagnostic pop
 
 static int add_new_arrays(struct mdstat_ent *mdstat, struct state **statelist,
 			  int test, struct alert_info *info)
diff --git a/mdopen.c b/mdopen.c
index 98c54e4..4f72b69 100644
--- a/mdopen.c
+++ b/mdopen.c
@@ -26,6 +26,9 @@
 #include "md_p.h"
 #include <ctype.h>
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wformat-truncation"
+
 void make_parts(char *dev, int cnt)
 {
 	/* make 'cnt' partition devices for 'dev'
@@ -101,6 +104,7 @@ void make_parts(char *dev, int cnt)
 	}
 	free(name);
 }
+#pragma GCC diagnostic pop
 
 int create_named_array(char *devnm)
 {
diff --git a/super-ddf.c b/super-ddf.c
index 618542c..6ed4e7e 100644
--- a/super-ddf.c
+++ b/super-ddf.c
@@ -2828,6 +2828,9 @@ static void _set_config_size(struct phys_disk_entry *pde, const struct dl *dl)
 		(unsigned long long)cfs, (unsigned long long)(dl->size-cfs));
 }
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wformat-overflow"
+
 /* Add a device to a container, either while creating it or while
  * expanding a pre-existing container
  */
@@ -2964,6 +2967,7 @@ static int add_to_super_ddf(struct supertype *st,
 
 	return 0;
 }
+#pragma GCC diagnostic pop
 
 static int remove_from_super_ddf(struct supertype *st, mdu_disk_info_t *dk)
 {
diff --git a/super-intel.c b/super-intel.c
index 1bc4b80..39d0e92 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -333,6 +333,11 @@ struct md_list {
 };
 
 #define pr_vrb(fmt, arg...) (void) (verbose && pr_err(fmt, ##arg))
+#pragma GCC diagnostic push
+# if __GNUC__ == 8
+# pragma GCC diagnostic ignored "-Wstringop-truncation"
+# endif
+#pragma GCC diagnostic ignored "-Wformat-truncation"
 
 static __u8 migr_type(struct imsm_dev *dev)
 {
@@ -12208,3 +12213,4 @@ struct superswitch super_imsm = {
 	.clear_bad_block  = imsm_clear_badblock,
 	.get_bad_blocks   = imsm_get_badblocks,
 };
+#pragma GCC diagnostic pop
diff --git a/super0.c b/super0.c
index 42989b9..f5e8031 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;
diff --git a/super1.c b/super1.c
index 636a286..f894cbb 100644
--- a/super1.c
+++ b/super1.c
@@ -1176,6 +1176,10 @@ static struct mdinfo *container_content1(struct supertype *st, char *subarray)
 	return info;
 }
 
+#pragma GCC diagnostic push
+# if __GNUC__ == 8
+# pragma GCC diagnostic ignored "-Wstringop-truncation"
+#endif
 static int update_super1(struct supertype *st, struct mdinfo *info,
 			 char *update, char *devname, int verbose,
 			 int uuid_set, char *homehost)
@@ -1641,6 +1645,7 @@ static int init_super1(struct supertype *st, mdu_array_info_t *info,
 
 	return 1;
 }
+#pragma GCC diagnostic pop
 
 struct devinfo {
 	int fd;