6b2237f96e
Add 0031-multipath-fix-issues-found-by-compiling-with-gcc-10.patch * Patch submitted upstream Resolves bz #1799276
120 lines
3.9 KiB
Diff
120 lines
3.9 KiB
Diff
From b665961ce1acc273b936ef8593e328c413d35ba7 Mon Sep 17 00:00:00 2001
|
|
From: Benjamin Marzinski <bmarzins@redhat.com>
|
|
Date: Tue, 11 Feb 2020 17:01:08 -0600
|
|
Subject: [PATCH] multipath: fix issues found by compiling with gcc 10
|
|
|
|
Compiling with gcc 10 raised a number of warings about buffer sizes,
|
|
and an error based on declaring ___error1___ in multiple c files,
|
|
do to it being in structs.h. fix these
|
|
|
|
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
|
---
|
|
kpartx/dasd.c | 6 +++---
|
|
libmultipath/print.c | 3 ++-
|
|
libmultipath/structs.c | 6 ++++++
|
|
libmultipath/structs.h | 5 -----
|
|
multipath/main.c | 2 +-
|
|
5 files changed, 12 insertions(+), 10 deletions(-)
|
|
|
|
diff --git a/kpartx/dasd.c b/kpartx/dasd.c
|
|
index d95d8ca0..42986e78 100644
|
|
--- a/kpartx/dasd.c
|
|
+++ b/kpartx/dasd.c
|
|
@@ -188,7 +188,7 @@ read_dasd_pt(int fd, struct slice all, struct slice *sp, int ns)
|
|
goto out;
|
|
}
|
|
|
|
- if ((!info.FBA_layout) && (!strcmp(info.type, "ECKD")))
|
|
+ if ((!info.FBA_layout) && (!strncmp(info.type, "ECKD", 4)))
|
|
memcpy (&vlabel, data, sizeof(vlabel));
|
|
else {
|
|
bzero(&vlabel,4);
|
|
@@ -218,7 +218,7 @@ read_dasd_pt(int fd, struct slice all, struct slice *sp, int ns)
|
|
sp[0].size = size - sp[0].start;
|
|
retval = 1;
|
|
} else if ((strncmp(type, "VOL1", 4) == 0) &&
|
|
- (!info.FBA_layout) && (!strcmp(info.type, "ECKD"))) {
|
|
+ (!info.FBA_layout) && (!strncmp(info.type, "ECKD",4))) {
|
|
/*
|
|
* New style VOL1 labeled disk
|
|
*/
|
|
@@ -267,7 +267,7 @@ read_dasd_pt(int fd, struct slice all, struct slice *sp, int ns)
|
|
if (vlabel.ldl_version == 0xf2) {
|
|
fmt_size = sectors512(vlabel.formatted_blocks,
|
|
blocksize);
|
|
- } else if (!strcmp(info.type, "ECKD")) {
|
|
+ } else if (!strncmp(info.type, "ECKD",4)) {
|
|
/* formatted w/o large volume support */
|
|
fmt_size = geo.cylinders * geo.heads
|
|
* geo.sectors * (blocksize >> 9);
|
|
diff --git a/libmultipath/print.c b/libmultipath/print.c
|
|
index 907469ad..61e123de 100644
|
|
--- a/libmultipath/print.c
|
|
+++ b/libmultipath/print.c
|
|
@@ -29,6 +29,7 @@
|
|
#include "uevent.h"
|
|
#include "debug.h"
|
|
#include "discovery.h"
|
|
+#include "util.h"
|
|
|
|
#define MAX(x,y) (((x) > (y)) ? (x) : (y))
|
|
#define MIN(x,y) (((x) > (y)) ? (y) : (x))
|
|
@@ -2028,7 +2029,7 @@ int snprint_devices(struct config *conf, char * buff, int len,
|
|
|
|
devptr = devpath + 11;
|
|
*devptr = '\0';
|
|
- strncat(devptr, blkdev->d_name, PATH_MAX-12);
|
|
+ strlcpy(devptr, blkdev->d_name, PATH_MAX-11);
|
|
if (stat(devpath, &statbuf) < 0)
|
|
continue;
|
|
|
|
diff --git a/libmultipath/structs.c b/libmultipath/structs.c
|
|
index bf7fdd73..46e8bb18 100644
|
|
--- a/libmultipath/structs.c
|
|
+++ b/libmultipath/structs.c
|
|
@@ -20,6 +20,12 @@
|
|
#include "prioritizers/alua_spc3.h"
|
|
#include "dm-generic.h"
|
|
|
|
+/*
|
|
+ * _FIND_MULTIPATHS_F must have the same value as YNU_YES.
|
|
+ * Generate a compile time error if that isn't the case.
|
|
+ */
|
|
+char ___error1___[-(_FIND_MULTIPATHS_F != YNU_YES)];
|
|
+
|
|
struct adapter_group *
|
|
alloc_adaptergroup(void)
|
|
{
|
|
diff --git a/libmultipath/structs.h b/libmultipath/structs.h
|
|
index a3adf906..191a5945 100644
|
|
--- a/libmultipath/structs.h
|
|
+++ b/libmultipath/structs.h
|
|
@@ -102,11 +102,6 @@ enum yes_no_undef_states {
|
|
#define _FIND_MULTIPATHS_F (1 << 1)
|
|
#define _FIND_MULTIPATHS_I (1 << 2)
|
|
#define _FIND_MULTIPATHS_N (1 << 3)
|
|
-/*
|
|
- * _FIND_MULTIPATHS_F must have the same value as YNU_YES.
|
|
- * Generate a compile time error if that isn't the case.
|
|
- */
|
|
-char ___error1___[-(_FIND_MULTIPATHS_F != YNU_YES)];
|
|
|
|
#define find_multipaths_on(conf) \
|
|
(!!((conf)->find_multipaths & _FIND_MULTIPATHS_F))
|
|
diff --git a/multipath/main.c b/multipath/main.c
|
|
index 22aff7be..ed214183 100644
|
|
--- a/multipath/main.c
|
|
+++ b/multipath/main.c
|
|
@@ -1029,7 +1029,7 @@ main (int argc, char *argv[])
|
|
if (!dev)
|
|
goto out;
|
|
|
|
- strncpy(dev, argv[optind], FILE_NAME_SIZE);
|
|
+ strlcpy(dev, argv[optind], FILE_NAME_SIZE);
|
|
if (dev_type != DEV_UEVENT)
|
|
dev_type = get_dev_type(dev);
|
|
if (dev_type == DEV_NONE) {
|
|
--
|
|
2.17.2
|
|
|