[mdadm PATCH 1/3] Fix building error because of -Werror=format-overflow

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



There are some building error such as:
Monitor.c:570:14: error: '%02d' directive output may be truncated writing between 2 and 10 bytes into a region of size 8 [-Werror=format-truncation=]
      Rebuild%02d, mse->percent);
              ^~~~
Monitor.c:570:6: note: directive argument in the range [0, 2147483647]
      Rebuild%02d, mse->percent);
      ^~~~~~~~~~~~~

Give the target enough space to fix these problems

Signed-off-by: Xiao Ni <xni@xxxxxxxxxx>
---
 Monitor.c   | 2 +-
 mdopen.c    | 2 +-
 super-ddf.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/Monitor.c b/Monitor.c
index c7c05d2..036103f 100644
--- a/Monitor.c
+++ b/Monitor.c
@@ -557,7 +557,7 @@ static int check_array(struct state *st, struct mdstat_ent *mdstat,
 		alert("RebuildStarted", dev, NULL, ainfo);
 	if (st->percent >= 0 && mse->percent >= 0 &&
 	    (mse->percent / increments) > (st->percent / increments)) {
-		char percentalert[15];
+		char percentalert[18];
 		/*
 		 * "RebuildNN" (10 chars) or "RebuildStarted" (15 chars)
 		 */
diff --git a/mdopen.c b/mdopen.c
index 4ec13f5..2d2ff8e 100644
--- a/mdopen.c
+++ b/mdopen.c
@@ -45,7 +45,7 @@ void make_parts(char *dev, int cnt)
 	char *name;
 	int dig = isdigit(dev[strlen(dev)-1]);
 	char orig[1024];
-	char sym[1024];
+	char sym[1040];
 	int err;
 
 	if (cnt == 0)
diff --git a/super-ddf.c b/super-ddf.c
index d02a19a..539f832 100644
--- a/super-ddf.c
+++ b/super-ddf.c
@@ -151,7 +151,7 @@ static inline be64 cpu_to_be64(__u64 x)
 #define	DDF_VENDOR_LOG_MAGIC	cpu_to_be32(0x01dBEEF0)
 #define	DDF_BBM_LOG_MAGIC	cpu_to_be32(0xABADB10C)
 
-#define	DDF_GUID_LEN	24
+#define	DDF_GUID_LEN	48
 #define DDF_REVISION_0	"01.00.00"
 #define DDF_REVISION_2	"01.02.00"
 
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux