Accepting request 831970 from Base:System

OBS-URL: https://build.opensuse.org/request/show/831970
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/lvm2?expand=0&rev=139
This commit is contained in:
Dominique Leuenberger 2020-09-08 20:43:39 +00:00 committed by Git OBS Bridge
commit 219f3549a9
5 changed files with 374 additions and 8 deletions

View File

@ -0,0 +1,30 @@
From b918afb693a62938e8189a5d07b13df8007ae062 Mon Sep 17 00:00:00 2001
From: Zdenek Kabelac <zkabelac@redhat.com>
Date: Fri, 28 Aug 2020 19:15:42 +0200
Subject: [PATCH] tools: move struct element before variable lenght list
Move prio field before 'variable' struct array field.
Interesting why this has not been catched yet.
TODO: think about test case
---
tools/tools.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/tools.h b/tools/tools.h
index c3d780d..4b944e2 100644
--- a/tools/tools.h
+++ b/tools/tools.h
@@ -109,8 +109,8 @@ struct arg_values {
struct arg_value_group_list {
struct dm_list list;
- struct arg_values arg_values[0];
uint32_t prio;
+ struct arg_values arg_values[0];
};
#define PERMITTED_READ_ONLY 0x00000002
--
1.8.3.1

View File

@ -1,9 +1,9 @@
From c082344068ac0b080c5f3d97e0272952a665813b Mon Sep 17 00:00:00 2001
From cc2218b4014015bd2633454e683293851183e08c Mon Sep 17 00:00:00 2001
From: Zhao Heming <heming.zhao@suse.com>
Date: Thu, 20 Aug 2020 23:21:11 +0800
Subject: [PATCH] change zero-sized array to fexlible array
Date: Fri, 21 Aug 2020 00:05:04 +0800
Subject: [PATCH] gcc: change zero-sized array to fexlible array
this change make gcc happy with compiling option: [-Wstringop-overflow=]
this patch makes gcc happy with compiling option: [-Wstringop-overflow=]
Signed-off-by: Zhao Heming <heming.zhao@suse.com>
---
@ -13,7 +13,7 @@ Signed-off-by: Zhao Heming <heming.zhao@suse.com>
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/device_mapper/libdm-common.c b/device_mapper/libdm-common.c
index bc691d6..3627457 100644
index b6d08f5..9b87e4e 100644
--- a/device_mapper/libdm-common.c
+++ b/device_mapper/libdm-common.c
@@ -1445,7 +1445,7 @@ struct node_op_parms {
@ -39,7 +39,7 @@ index b2c99fc..96f7df6 100644
static void _store_str(char **pos, char **ptr, const char *str)
diff --git a/libdm/libdm-common.c b/libdm/libdm-common.c
index d75c704..d587c32 100644
index 466c74b..a288297 100644
--- a/libdm/libdm-common.c
+++ b/libdm/libdm-common.c
@@ -1443,7 +1443,7 @@ struct node_op_parms {

View File

@ -0,0 +1,321 @@
From fd96f1014b11d073d775ea4777f3b3ba2eb93520 Mon Sep 17 00:00:00 2001
From: Zdenek Kabelac <zkabelac@redhat.com>
Date: Fri, 28 Aug 2020 19:15:01 +0200
Subject: [PATCH] gcc: zero-sized array to fexlible array C99
Switch remaining zero sized struct to flexible arrays to be C99
complient.
These simple rules should apply:
- The incomplete array type must be the last element within the structure.
- There cannot be an array of structures that contain a flexible array member.
- Structures that contain a flexible array member cannot be used as a member of another structure.
- The structure must contain at least one named member in addition to the flexible array member.
Although some of the code pieces should be still improved.
---
WHATS_NEW | 1 +
base/data-struct/hash.c | 2 +-
base/data-struct/radix-tree-adaptive.c | 2 +-
daemons/lvmlockd/lvmlockd-internal.h | 2 +-
device_mapper/all.h | 6 +++---
device_mapper/misc/dm-ioctl.h | 8 ++++----
lib/device/dev-cache.c | 2 +-
lib/format_text/layout.h | 6 +++---
lib/label/label.c | 2 +-
lib/metadata/lv_manip.c | 2 +-
libdm/datastruct/hash.c | 2 +-
libdm/libdevmapper.h | 6 +++---
libdm/libdm-stats.c | 2 +-
libdm/misc/dm-ioctl.h | 8 ++++----
tools/tools.h | 2 +-
15 files changed, 27 insertions(+), 26 deletions(-)
diff --git a/base/data-struct/hash.c b/base/data-struct/hash.c
index 0a0541d..5ef5ed2 100644
--- a/base/data-struct/hash.c
+++ b/base/data-struct/hash.c
@@ -22,7 +22,7 @@ struct dm_hash_node {
void *data;
unsigned data_len;
unsigned keylen;
- char key[0];
+ char key[];
};
struct dm_hash_table {
diff --git a/base/data-struct/radix-tree-adaptive.c b/base/data-struct/radix-tree-adaptive.c
index b9ba417..3a46cc1 100644
--- a/base/data-struct/radix-tree-adaptive.c
+++ b/base/data-struct/radix-tree-adaptive.c
@@ -47,7 +47,7 @@ struct value_chain {
struct prefix_chain {
struct value child;
unsigned len;
- uint8_t prefix[0];
+ uint8_t prefix[];
};
struct node4 {
diff --git a/daemons/lvmlockd/lvmlockd-internal.h b/daemons/lvmlockd/lvmlockd-internal.h
index 191c449..14bdfee 100644
--- a/daemons/lvmlockd/lvmlockd-internal.h
+++ b/daemons/lvmlockd/lvmlockd-internal.h
@@ -158,7 +158,7 @@ struct resource {
struct list_head locks;
struct list_head actions;
char lv_args[MAX_ARGS+1];
- char lm_data[0]; /* lock manager specific data */
+ char lm_data[]; /* lock manager specific data */
};
#define LD_LF_PERSISTENT 0x00000001
diff --git a/device_mapper/all.h b/device_mapper/all.h
index c3c6219..ace3b69 100644
--- a/device_mapper/all.h
+++ b/device_mapper/all.h
@@ -164,20 +164,20 @@ struct dm_info {
struct dm_deps {
uint32_t count;
uint32_t filler;
- uint64_t device[0];
+ uint64_t device[];
};
struct dm_names {
uint64_t dev;
uint32_t next; /* Offset to next struct from start of this struct */
- char name[0];
+ char name[];
};
struct dm_versions {
uint32_t next; /* Offset to next struct from start of this struct */
uint32_t version[3];
- char name[0];
+ char name[];
};
int dm_get_library_version(char *version, size_t size);
diff --git a/device_mapper/misc/dm-ioctl.h b/device_mapper/misc/dm-ioctl.h
index cc2374c..49954a7 100644
--- a/device_mapper/misc/dm-ioctl.h
+++ b/device_mapper/misc/dm-ioctl.h
@@ -183,7 +183,7 @@ struct dm_target_spec {
struct dm_target_deps {
uint32_t count; /* Array size */
uint32_t padding; /* unused */
- uint64_t dev[0]; /* out */
+ uint64_t dev[]; /* out */
};
/*
@@ -193,7 +193,7 @@ struct dm_name_list {
uint64_t dev;
uint32_t next; /* offset to the next record from
the _start_ of this */
- char name[0];
+ char name[];
};
/*
@@ -203,7 +203,7 @@ struct dm_target_versions {
uint32_t next;
uint32_t version[3];
- char name[0];
+ char name[];
};
/*
@@ -212,7 +212,7 @@ struct dm_target_versions {
struct dm_target_msg {
uint64_t sector; /* Device sector */
- char message[0];
+ char message[];
};
/*
diff --git a/lib/device/dev-cache.c b/lib/device/dev-cache.c
index c3f7c49..d4e2658 100644
--- a/lib/device/dev-cache.c
+++ b/lib/device/dev-cache.c
@@ -35,7 +35,7 @@ struct dev_iter {
struct dir_list {
struct dm_list list;
- char dir[0];
+ char dir[];
};
static struct {
diff --git a/lib/format_text/layout.h b/lib/format_text/layout.h
index c3dfe8e..df7ed3a 100644
--- a/lib/format_text/layout.h
+++ b/lib/format_text/layout.h
@@ -33,7 +33,7 @@ struct pv_header_extension {
uint32_t version;
uint32_t flags;
/* NULL-terminated list of bootloader areas */
- struct disk_locn bootloader_areas_xl[0];
+ struct disk_locn bootloader_areas_xl[];
} __attribute__ ((packed));
/* Fields with the suffix _xl should be xlate'd wherever they appear */
@@ -46,7 +46,7 @@ struct pv_header {
/* NULL-terminated list of data areas followed by */
/* NULL-terminated list of metadata area headers */
- struct disk_locn disk_areas_xl[0]; /* Two lists */
+ struct disk_locn disk_areas_xl[]; /* Two lists */
} __attribute__ ((packed));
/*
@@ -76,7 +76,7 @@ struct mda_header {
uint64_t start; /* Absolute start byte of mda_header */
uint64_t size; /* Size of metadata area */
- struct raw_locn raw_locns[0]; /* NULL-terminated list */
+ struct raw_locn raw_locns[]; /* NULL-terminated list */
} __attribute__ ((packed));
struct mda_header *raw_read_mda_header(const struct format_type *fmt,
diff --git a/lib/label/label.c b/lib/label/label.c
index 4d369d4..8e68f93 100644
--- a/lib/label/label.c
+++ b/lib/label/label.c
@@ -43,7 +43,7 @@ struct labeller_i {
struct dm_list list;
struct labeller *l;
- char name[0];
+ char name[];
};
static struct dm_list _labellers;
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index c47ec72..95ca2df 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -1798,7 +1798,7 @@ struct alloc_handle {
* Contains area_count lists of areas allocated to data stripes
* followed by log_area_count lists of areas allocated to log stripes.
*/
- struct dm_list alloced_areas[0];
+ struct dm_list alloced_areas[];
};
/*
diff --git a/libdm/datastruct/hash.c b/libdm/datastruct/hash.c
index 4c94003..726347e 100644
--- a/libdm/datastruct/hash.c
+++ b/libdm/datastruct/hash.c
@@ -20,7 +20,7 @@ struct dm_hash_node {
void *data;
unsigned data_len;
unsigned keylen;
- char key[0];
+ char key[];
};
struct dm_hash_table {
diff --git a/libdm/libdevmapper.h b/libdm/libdevmapper.h
index e9b1405..059b96f 100644
--- a/libdm/libdevmapper.h
+++ b/libdm/libdevmapper.h
@@ -165,20 +165,20 @@ struct dm_info {
struct dm_deps {
uint32_t count;
uint32_t filler;
- uint64_t device[0];
+ uint64_t device[];
};
struct dm_names {
uint64_t dev;
uint32_t next; /* Offset to next struct from start of this struct */
- char name[0];
+ char name[];
};
struct dm_versions {
uint32_t next; /* Offset to next struct from start of this struct */
uint32_t version[3];
- char name[0];
+ char name[];
};
int dm_get_library_version(char *version, size_t size);
diff --git a/libdm/libdm-stats.c b/libdm/libdm-stats.c
index 5379bed..f8d79d8 100644
--- a/libdm/libdm-stats.c
+++ b/libdm/libdm-stats.c
@@ -65,7 +65,7 @@ struct dm_histogram {
const struct dm_stats_region *region;
uint64_t sum; /* Sum of histogram bin counts. */
int nr_bins; /* Number of histogram bins assigned. */
- struct dm_histogram_bin bins[0];
+ struct dm_histogram_bin bins[];
};
/*
diff --git a/libdm/misc/dm-ioctl.h b/libdm/misc/dm-ioctl.h
index 52a7a93..55dee21 100644
--- a/libdm/misc/dm-ioctl.h
+++ b/libdm/misc/dm-ioctl.h
@@ -183,7 +183,7 @@ struct dm_target_spec {
struct dm_target_deps {
uint32_t count; /* Array size */
uint32_t padding; /* unused */
- uint64_t dev[0]; /* out */
+ uint64_t dev[]; /* out */
};
/*
@@ -193,7 +193,7 @@ struct dm_name_list {
uint64_t dev;
uint32_t next; /* offset to the next record from
the _start_ of this */
- char name[0];
+ char name[];
};
/*
@@ -203,7 +203,7 @@ struct dm_target_versions {
uint32_t next;
uint32_t version[3];
- char name[0];
+ char name[];
};
/*
@@ -212,7 +212,7 @@ struct dm_target_versions {
struct dm_target_msg {
uint64_t sector; /* Device sector */
- char message[0];
+ char message[];
};
/*
diff --git a/tools/tools.h b/tools/tools.h
index 4b944e2..befff57 100644
--- a/tools/tools.h
+++ b/tools/tools.h
@@ -110,7 +110,7 @@ struct arg_values {
struct arg_value_group_list {
struct dm_list list;
uint32_t prio;
- struct arg_values arg_values[0];
+ struct arg_values arg_values[];
};
#define PERMITTED_READ_ONLY 0x00000002
--
1.8.3.1

View File

@ -1,3 +1,14 @@
-------------------------------------------------------------------
Thu Sep 03 08:16:00 UTC 2020 - heming.zhao@suse.com
- lvm can't pass build with gcc option Wstringop-overflow (bsc#1175565)
- remove suse speical patch
- bug-1175565_lvm-cant-pass-build-with-gcc-option-Wstringop-overflow.patch
- add upstream patch
+ bug-1175565_01-tools-move-struct-element-before-variable-lenght-lis.patch
+ bug-1175565_02-gcc-change-zero-sized-array-to-fexlible-array.patch
+ bug-1175565_03-gcc-zero-sized-array-to-fexlible-array-C99.patch
-------------------------------------------------------------------
Thu Aug 20 04:49:00 UTC 2020 - heming.zhao@suse.com

View File

@ -62,6 +62,9 @@ Source42: ftp://sourceware.org/pub/lvm2/LVM2.%{version}.tgz.asc
Source99: baselibs.conf
# Upstream patches
# n/a
Patch0001: bug-1175565_01-tools-move-struct-element-before-variable-lenght-lis.patch
Patch0002: bug-1175565_02-gcc-change-zero-sized-array-to-fexlible-array.patch
Patch0003: bug-1175565_03-gcc-zero-sized-array-to-fexlible-array-C99.patch
# SUSE patches: 1000+ for LVM
# Never upstream
Patch1001: cmirrord_remove_date_time_from_compilation.patch
@ -69,7 +72,6 @@ Patch1002: fate-309425_display-dm-name-for-lv-name.patch
Patch1003: fate-31841_fsadm-add-support-for-btrfs.patch
Patch1004: bug-935623_dmeventd-fix-dso-name-wrong-compare.patch
Patch1005: bug-998893_make_pvscan_service_after_multipathd.patch
Patch1006: bug-1175565_lvm-cant-pass-build-with-gcc-option-Wstringop-overflow.patch
# SUSE patches 2000+ for device mapper, udev rules
Patch2001: bug-1012973_simplify-special-case-for-md-in-69-dm-lvm-metadata.patch
# SUSE patches 3000+ for test code
@ -118,12 +120,14 @@ Volume Manager.
%prep
%setup -q -n LVM2.%{version}
%patch0001 -p1
%patch0002 -p1
%patch0003 -p1
%patch1001 -p1
%patch1002 -p1
%patch1003 -p1
%patch1004 -p1
%patch1005 -p1
%patch1006 -p1
%patch2001 -p1
%if !%{with lockd}