From 6b2237f96ec644c8e5f2c61a305defd7acad82f8 Mon Sep 17 00:00:00 2001 From: Benjamin Marzinski Date: Wed, 12 Feb 2020 17:05:28 -0600 Subject: [PATCH] device-mapper-multipath-0.8.2-3 Add 0031-multipath-fix-issues-found-by-compiling-with-gcc-10.patch * Patch submitted upstream Resolves bz #1799276 --- ...ssues-found-by-compiling-with-gcc-10.patch | 119 ++++++++++++++++++ device-mapper-multipath.spec | 8 +- 2 files changed, 126 insertions(+), 1 deletion(-) create mode 100644 0031-multipath-fix-issues-found-by-compiling-with-gcc-10.patch diff --git a/0031-multipath-fix-issues-found-by-compiling-with-gcc-10.patch b/0031-multipath-fix-issues-found-by-compiling-with-gcc-10.patch new file mode 100644 index 0000000..b55e393 --- /dev/null +++ b/0031-multipath-fix-issues-found-by-compiling-with-gcc-10.patch @@ -0,0 +1,119 @@ +From b665961ce1acc273b936ef8593e328c413d35ba7 Mon Sep 17 00:00:00 2001 +From: Benjamin Marzinski +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 +--- + 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 + diff --git a/device-mapper-multipath.spec b/device-mapper-multipath.spec index 0fdf21a..177d563 100644 --- a/device-mapper-multipath.spec +++ b/device-mapper-multipath.spec @@ -1,6 +1,6 @@ Name: device-mapper-multipath Version: 0.8.2 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Tools to manage multipath devices using device-mapper License: GPLv2 URL: http://christophe.varoqui.free.fr/ @@ -40,6 +40,7 @@ Patch0027: 0027-RH-warn-on-invalid-regex-instead-of-failing.patch Patch0028: 0028-RH-reset-default-find_mutipaths-value-to-off.patch Patch0029: 0029-RH-Fix-nvme-compilation-warning.patch Patch0030: 0030-RH-attempt-to-get-ANA-info-via-sysfs-first.patch +Patch0031: 0031-multipath-fix-issues-found-by-compiling-with-gcc-10.patch # runtime Requires: %{name}-libs = %{version}-%{release} @@ -234,6 +235,11 @@ fi %{_pkgconfdir}/libdmmp.pc %changelog +* Wed Feb 12 2020 Benjamin Marzinski - 0.8.2-3 +- Add 0031-multipath-fix-issues-found-by-compiling-with-gcc-10.patch + * Patch submitted upstream +- Resolves bz #1799276 + * Tue Jan 28 2020 Fedora Release Engineering - 0.8.2-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild