stable-2.02 - cov: hide intentionaly ptr arithmetic report
by Marian Csontos
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=e4bb94a93e9cda69571...
Commit: e4bb94a93e9cda695717093024800f637aead51c
Parent: 93ac80037aefb1f57c7996db3ccfe440b6bc8308
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Nov 2 22:29:43 2018 +0100
Committer: Marian Csontos <mcsontos(a)redhat.com>
CommitterDate: Tue Mar 5 12:17:18 2019 +0100
cov: hide intentionaly ptr arithmetic report
Only single region count is ever replaced with on-stack uint64_t.
(cherry picked from commit a91ac41b93eff0f3ebd3af3319e8bbcb1fe8d00f)
---
tools/dmsetup.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/tools/dmsetup.c b/tools/dmsetup.c
index 5b1a12e..a6610a9 100644
--- a/tools/dmsetup.c
+++ b/tools/dmsetup.c
@@ -5241,6 +5241,7 @@ static int _do_stats_create_regions(struct dm_stats *dms,
*/
this_start = (segments) ? segment_start : start;
this_len = (segments) ? segment_len : this_len;
+ /* coverity[ptr_arith] intentional */
if (!(r = dm_stats_create_region(dms, ®ion_ids[count],
this_start, this_len, step,
precise, bounds,
5 years
stable-2.02 - cov: mark warning as expected one
by Marian Csontos
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=93ac80037aefb1f57c7...
Commit: 93ac80037aefb1f57c7996db3ccfe440b6bc8308
Parent: c9e5e6800c3225c9eb6cd54f143624c20eda44be
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Nov 1 15:44:13 2018 +0100
Committer: Marian Csontos <mcsontos(a)redhat.com>
CommitterDate: Tue Mar 5 12:16:33 2019 +0100
cov: mark warning as expected one
(cherry picked from commit 9238b972c543a83fbd553cc44a916608809cfc53)
Conflicts:
base/data-struct/radix-tree-adaptive.c
device_mapper/libdm-file.c
---
libdm/libdm-file.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/libdm/libdm-file.c b/libdm/libdm-file.c
index e7416f1..5735642 100644
--- a/libdm/libdm-file.c
+++ b/libdm/libdm-file.c
@@ -221,6 +221,8 @@ retry_fcntl:
goto fail_close_unlink;
}
+ /* coverity[leaked_handle] intentional leak of fd handle here */
+
return 1;
fail_close_unlink:
5 years
stable-2.02 - cov: split check for type assignment
by Marian Csontos
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=c9e5e6800c3225c9eb6...
Commit: c9e5e6800c3225c9eb6cd54f143624c20eda44be
Parent: f0f68791f31c8cf0ca2c4f0bbee86dd37a69494f
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Nov 1 15:33:34 2018 +0100
Committer: Marian Csontos <mcsontos(a)redhat.com>
CommitterDate: Tue Mar 5 12:16:07 2019 +0100
cov: split check for type assignment
Check that type is always defined, if not make it explicit internal
error (although logged as debug - so catched only with proper lvm.conf
setting).
This ensures later type being NULL can't be dereferenced with coredump.
(cherry picked from commit 79879bd201d4156312bb03fc0b7228ce34a3bf38)
---
libdm/libdm-report.c | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/libdm/libdm-report.c b/libdm/libdm-report.c
index 0401f9c..b58e3fe 100644
--- a/libdm/libdm-report.c
+++ b/libdm/libdm-report.c
@@ -748,10 +748,11 @@ static void _display_fields_more(struct dm_report *rh,
id_len = strlen(type->prefix) + 3;
for (f = 0; fields[f].report_fn; f++) {
- if ((type = _find_type(rh, fields[f].type)) && type->desc)
- desc = type->desc;
- else
- desc = " ";
+ if (!(type = _find_type(rh, fields[f].type))) {
+ log_debug(INTERNAL_ERROR "Field type undefined.");
+ continue;
+ }
+ desc = (type->desc) ? : " ";
if (desc != last_desc) {
if (*last_desc)
log_warn(" ");
5 years
stable-2.02 - cov: shutdown warning
by Marian Csontos
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=f0f68791f31c8cf0ca2...
Commit: f0f68791f31c8cf0ca2c4f0bbee86dd37a69494f
Parent: b39c26ddc335e308c10777ea423f341cb9e783b8
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Oct 16 21:46:44 2018 +0200
Committer: Marian Csontos <mcsontos(a)redhat.com>
CommitterDate: Tue Mar 5 12:15:40 2019 +0100
cov: shutdown warning
Since previous patch reverted coverity patch as this case is intentional,
provide override this coverity warning.
(cherry picked from commit 05b57748274492aa76e530e4513e5f8e9a39a735)
---
libdm/libdm-stats.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/libdm/libdm-stats.c b/libdm/libdm-stats.c
index 6b4e3d8..3078596 100644
--- a/libdm/libdm-stats.c
+++ b/libdm/libdm-stats.c
@@ -1009,6 +1009,7 @@ static int _stats_parse_list(struct dm_stats *dms, const char *resp)
* dm_task_get_message_response() returns a 'const char *' but
* since fmemopen also permits "w" it expects a 'char *'.
*/
+ /* coverity[alloc_strlen] intentional */
if (!(list_rows = fmemopen((char *)resp, strlen(resp), "r")))
return_0;
@@ -1240,6 +1241,7 @@ static int _stats_parse_region(struct dm_stats *dms, const char *resp,
* dm_task_get_message_response() returns a 'const char *' but
* since fmemopen also permits "w" it expects a 'char *'.
*/
+ /* coverity[alloc_strlen] intentional */
stats_rows = fmemopen((char *)resp, strlen(resp), "r");
if (!stats_rows)
goto_bad;
5 years
stable-2.02 - revert "cov: dm stats missed terminating null"
by Marian Csontos
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=b39c26ddc335e308c10...
Commit: b39c26ddc335e308c10777ea423f341cb9e783b8
Parent: d1ae1455b48fb09c4530b3b823bf02df50450b18
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Oct 16 19:13:34 2018 +0200
Committer: Marian Csontos <mcsontos(a)redhat.com>
CommitterDate: Tue Mar 5 12:15:16 2019 +0100
revert "cov: dm stats missed terminating null"
This reverts commit 20971f7034cbd329f873e08869bfb7acf3f1ac0e
as the parsing of 'dmstatus' started to fail on present \0 char.
(cherry picked from commit 6179cab877442aac884a0bfcd5c5541396980cdf)
---
libdm/libdm-stats.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/libdm/libdm-stats.c b/libdm/libdm-stats.c
index 479861e..6b4e3d8 100644
--- a/libdm/libdm-stats.c
+++ b/libdm/libdm-stats.c
@@ -1009,7 +1009,7 @@ static int _stats_parse_list(struct dm_stats *dms, const char *resp)
* dm_task_get_message_response() returns a 'const char *' but
* since fmemopen also permits "w" it expects a 'char *'.
*/
- if (!(list_rows = fmemopen((char *)resp, strlen(resp) + 1, "r")))
+ if (!(list_rows = fmemopen((char *)resp, strlen(resp), "r")))
return_0;
/* begin region table */
@@ -1240,7 +1240,7 @@ static int _stats_parse_region(struct dm_stats *dms, const char *resp,
* dm_task_get_message_response() returns a 'const char *' but
* since fmemopen also permits "w" it expects a 'char *'.
*/
- stats_rows = fmemopen((char *)resp, strlen(resp) + 1, "r");
+ stats_rows = fmemopen((char *)resp, strlen(resp), "r");
if (!stats_rows)
goto_bad;
5 years
stable-2.02 - cov: ensure vars are set
by Marian Csontos
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=d1ae1455b48fb09c453...
Commit: d1ae1455b48fb09c4530b3b823bf02df50450b18
Parent: c115d92287e86d153f2f09d7f8aea8065098f91c
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Oct 15 15:27:45 2018 +0200
Committer: Marian Csontos <mcsontos(a)redhat.com>
CommitterDate: Tue Mar 5 12:14:43 2019 +0100
cov: ensure vars are set
Make sure, tmp_begin and tmp_end are always set, even for blind
coverity.
(cherry picked from commit 251366146727aac97af5de2eef855860d14910ca)
Conflicts:
device_mapper/libdm-report.c
---
libdm/libdm-report.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/libdm/libdm-report.c b/libdm/libdm-report.c
index 6d140af..0401f9c 100644
--- a/libdm/libdm-report.c
+++ b/libdm/libdm-report.c
@@ -2380,7 +2380,7 @@ static const char *_get_reserved(struct dm_report *rh, unsigned type,
{
const struct dm_report_reserved_value *iter = implicit ? NULL : rh->reserved_values;
const struct dm_report_field_reserved_value *frv;
- const char *tmp_begin, *tmp_end, *tmp_s = s;
+ const char *tmp_begin = NULL, *tmp_end = NULL, *tmp_s = s;
const char *name = NULL;
char c;
5 years
stable-2.02 - cov: dmstats check for failing malloc
by Marian Csontos
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=c115d92287e86d153f2...
Commit: c115d92287e86d153f2f09d7f8aea8065098f91c
Parent: ece117ee102684dc5380d30b73e4b992689eb85f
Author: Marian Csontos <mcsontos(a)redhat.com>
AuthorDate: Tue Mar 5 12:13:08 2019 +0100
Committer: Marian Csontos <mcsontos(a)redhat.com>
CommitterDate: Tue Mar 5 12:13:08 2019 +0100
cov: dmstats check for failing malloc
Add missing check for allocation success.
Backported from: 9b7121226258f7dfe759cc1f8625cbfb80fec161
---
tools/dmsetup.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/tools/dmsetup.c b/tools/dmsetup.c
index 0b5b808..5b1a12e 100644
--- a/tools/dmsetup.c
+++ b/tools/dmsetup.c
@@ -5216,7 +5216,10 @@ static int _do_stats_create_regions(struct dm_stats *dms,
if (!segments || (info.target_count == 1))
region_ids = ®ion_id;
else
- region_ids = dm_malloc(info.target_count * sizeof(*region_ids));
+ if (!(region_ids = dm_malloc(info.target_count * sizeof(*region_ids)))) {
+ log_error("Failed to allocated region IDs.");
+ goto out;
+ }
do {
uint64_t segment_start, segment_len;
5 years
stable-2.02 - cov: dm stats missed terminating null
by Marian Csontos
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=ece117ee102684dc538...
Commit: ece117ee102684dc5380d30b73e4b992689eb85f
Parent: 590a1ebcf78b8aae2a1e5ebaba1ac24a54435690
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Oct 15 14:45:16 2018 +0200
Committer: Marian Csontos <mcsontos(a)redhat.com>
CommitterDate: Tue Mar 5 12:10:36 2019 +0100
cov: dm stats missed terminating null
Coverity noticed allocating insufficient memory
for the terminating null of the string.
(cherry picked from commit 20971f7034cbd329f873e08869bfb7acf3f1ac0e)
---
libdm/libdm-stats.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/libdm/libdm-stats.c b/libdm/libdm-stats.c
index 6b4e3d8..479861e 100644
--- a/libdm/libdm-stats.c
+++ b/libdm/libdm-stats.c
@@ -1009,7 +1009,7 @@ static int _stats_parse_list(struct dm_stats *dms, const char *resp)
* dm_task_get_message_response() returns a 'const char *' but
* since fmemopen also permits "w" it expects a 'char *'.
*/
- if (!(list_rows = fmemopen((char *)resp, strlen(resp), "r")))
+ if (!(list_rows = fmemopen((char *)resp, strlen(resp) + 1, "r")))
return_0;
/* begin region table */
@@ -1240,7 +1240,7 @@ static int _stats_parse_region(struct dm_stats *dms, const char *resp,
* dm_task_get_message_response() returns a 'const char *' but
* since fmemopen also permits "w" it expects a 'char *'.
*/
- stats_rows = fmemopen((char *)resp, strlen(resp), "r");
+ stats_rows = fmemopen((char *)resp, strlen(resp) + 1, "r");
if (!stats_rows)
goto_bad;
5 years
master - WHATS_NEW: io_memory_size
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=07483cc165e210a2362...
Commit: 07483cc165e210a23627b4b6d5c89f9008c9e950
Parent: 7edbf8a441fab4518959523e3e726bcd66b2c6a8
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Mon Mar 4 12:22:49 2019 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Mon Mar 4 12:22:49 2019 -0600
WHATS_NEW: io_memory_size
---
WHATS_NEW | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index b1b19d1..61d347a 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,7 @@
Version 2.03.02 -
===================================
+ Change default io_memory_size from 4 to 8 MiB.
+ Add config setting io_memory_size to set bcache size.
Fix pvscan autoactivation for concurrent pvscans.
Change scan_lvs default to 0 so LVs are not scanned for PVs.
Thin-pool selects power-of-2 chunk size by default.
5 years
master - io: increase the default io memory from 4 to 8 MiB
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=7edbf8a441fab451895...
Commit: 7edbf8a441fab4518959523e3e726bcd66b2c6a8
Parent: 3584e0c0d5e5992a3c93e03de8b6042de0853ef2
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Mon Mar 4 11:18:34 2019 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Mon Mar 4 12:14:06 2019 -0600
io: increase the default io memory from 4 to 8 MiB
This is the default bcache size that is created at the
start of the command. It needs to be large enough to
hold a single copy of metadata for a given VG, or the
VG cannot be read or written (since the entire VG would
not fit into available memory.)
Increasing the default reduces the chances of anyone
needing to increase the default to use their VG.
The size can be set in lvm.conf global/io_memory_size;
the lower limit is 4 MiB and the upper limit is 128 MiB.
---
lib/config/defaults.h | 2 +-
lib/label/label.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/config/defaults.h b/lib/config/defaults.h
index ee6ca3a..3b8d341 100644
--- a/lib/config/defaults.h
+++ b/lib/config/defaults.h
@@ -314,6 +314,6 @@
#define DEFAULT_HINTS "all"
-#define DEFAULT_IO_MEMORY_SIZE_KB 4096
+#define DEFAULT_IO_MEMORY_SIZE_KB 8192
#endif /* _LVM_DEFAULTS_H */
diff --git a/lib/label/label.c b/lib/label/label.c
index 174139e..f356e18 100644
--- a/lib/label/label.c
+++ b/lib/label/label.c
@@ -794,7 +794,7 @@ out:
* the metadata size.)
*/
-#define MIN_BCACHE_BLOCKS 32 /* 4MB, currently matches DEFAULT_IO_MEMORY_SIZE_KB */
+#define MIN_BCACHE_BLOCKS 32 /* 4MB */
#define MAX_BCACHE_BLOCKS 1024
static int _setup_bcache(int num_devs)
5 years