master - coverity: ignore some dm_strncpy results
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=bc239f15eb935f...
Commit: bc239f15eb935f7962def5b8fde22b64b0b86b4f
Parent: d12ba022c8082de2d804010992c6ee1076b9f571
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Apr 22 14:06:15 2016 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Apr 22 14:15:36 2016 +0200
coverity: ignore some dm_strncpy results
Using them only for debug so ignorable.
Also don't mark stack char buffer alignment, compiler already knows
what's the best here.
---
lib/cache/lvmetad.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/lib/cache/lvmetad.c b/lib/cache/lvmetad.c
index 8d13a59..8a1a2c5 100644
--- a/lib/cache/lvmetad.c
+++ b/lib/cache/lvmetad.c
@@ -2028,8 +2028,8 @@ static void _update_changed_pvs_in_udev(struct cmd_context *cmd,
{
struct pv_cache_list *before;
struct pv_cache_list *after;
- char id_before[ID_LEN + 1] __attribute__((aligned(8)));
- char id_after[ID_LEN + 1] __attribute__((aligned(8)));
+ char id_before[ID_LEN + 1];
+ char id_after[ID_LEN + 1];
int found;
dm_list_iterate_items(before, pvc_before) {
@@ -2043,8 +2043,8 @@ static void _update_changed_pvs_in_udev(struct cmd_context *cmd,
continue;
if (!id_equal(&before->pvid, &after->pvid)) {
- dm_strncpy(id_before, (char *) &before->pvid, sizeof(id_before));
- dm_strncpy(id_after, (char *) &after->pvid, sizeof(id_after));
+ (void) dm_strncpy(id_before, (char *) &before->pvid, sizeof(id_before));
+ (void) dm_strncpy(id_after, (char *) &after->pvid, sizeof(id_after));
log_debug_devs("device %d:%d changed pvid from %s to %s",
(int)MAJOR(before->devt), (int)MINOR(before->devt),
@@ -2070,7 +2070,7 @@ static void _update_changed_pvs_in_udev(struct cmd_context *cmd,
}
if (!found) {
- dm_strncpy(id_before, (char *) &before->pvid, sizeof(id_before));
+ (void) dm_strncpy(id_before, (char *) &before->pvid, sizeof(id_before));
log_debug_devs("device %d:%d pvid %s vg %s is gone",
(int)MAJOR(before->devt), (int)MINOR(before->devt),
8 years
master - coverity: keep expression using 64bit
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=d12ba022c8082d...
Commit: d12ba022c8082de2d804010992c6ee1076b9f571
Parent: d564d9f39c73bdbb32413256586991993ad869ef
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Apr 22 14:05:03 2016 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Apr 22 14:15:36 2016 +0200
coverity: keep expression using 64bit
Use 64bit input to remain with whole evaluation in 64bit.
---
daemons/lvmlockd/lvmlockd-sanlock.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/daemons/lvmlockd/lvmlockd-sanlock.c b/daemons/lvmlockd/lvmlockd-sanlock.c
index c6534d8..b47c7f0 100644
--- a/daemons/lvmlockd/lvmlockd-sanlock.c
+++ b/daemons/lvmlockd/lvmlockd-sanlock.c
@@ -206,7 +206,7 @@ int lm_data_size_sanlock(void)
#define VG_LOCK_BEGIN UINT64_C(66)
#define LV_LOCK_BEGIN UINT64_C(67)
-static unsigned int daemon_test_lv_count;
+static uint64_t daemon_test_lv_count;
static int lock_lv_name_from_args(char *vg_args, char *lock_lv_name)
{
8 years
master - coverity: is_used_pv needs valid pv pointer
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=d564d9f39c73bd...
Commit: d564d9f39c73bdbb32413256586991993ad869ef
Parent: 2dc6b9785658d7bf0cf97170e8e1467b522bded6
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Apr 21 20:23:13 2016 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Apr 22 14:15:36 2016 +0200
coverity: is_used_pv needs valid pv pointer
---
lib/report/report.c | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/lib/report/report.c b/lib/report/report.c
index 08a6097..abf6a9e 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -3827,10 +3827,9 @@ int report_object(void *handle, int selection_only, const struct volume_group *v
_dummy_fid.fmt = pv->fmt;
}
- if (vg && is_orphan_vg(vg->name) && is_used_pv(pv)) {
+ if (vg && is_orphan_vg(vg->name) && pv && is_used_pv(pv)) {
obj.vg = &_unknown_vg;
- if (pv)
- _dummy_fid.fmt = pv->fmt;
+ _dummy_fid.fmt = pv->fmt;
}
return sh ? dm_report_object_is_selected(sh->selection_rh, &obj, 0, &sh->selected)
8 years
master - tests: make test independent on usage [] for hidden LVs
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=2dc6b9785658d7...
Commit: 2dc6b9785658d7bf0cf97170e8e1467b522bded6
Parent: 4ddf5a11cf333fdcf45eec907e12e10c41a9d578
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Apr 22 12:51:54 2016 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Apr 22 12:53:09 2016 +0200
tests: make test independent on usage [] for hidden LVs
---
test/shell/mirror-names.sh | 6 +++---
test/shell/pvmove-abort.sh | 4 ++--
test/shell/pvmove-resume-1.sh | 20 ++++++++++----------
test/shell/pvmove-resume-2.sh | 8 ++++----
test/shell/pvmove-resume-multiseg.sh | 22 ++++++++++++----------
5 files changed, 31 insertions(+), 29 deletions(-)
diff --git a/test/shell/mirror-names.sh b/test/shell/mirror-names.sh
index 9c2868a..789cbfc 100644
--- a/test/shell/mirror-names.sh
+++ b/test/shell/mirror-names.sh
@@ -37,11 +37,11 @@ lv_devices_() {
}
lv_mirror_log_() {
- test $(get lv_field $1 mirror_log) = $2
+ get lv_field $1 mirror_log | tr -d []
}
lv_convert_lv_() {
- get lv_field $1 convert_lv
+ get lv_field $1 convert_lv | tr -d []
}
enable_devs() {
@@ -87,7 +87,7 @@ lvcreate -an -Zn -l2 --type mirror -m1 -n $lv1 $vg
lv_devices_ $vg/$lv1 ${lv1}_mimage_0 ${lv1}_mimage_1
#COMM "mirror log is ${lv1}_mlog"
-lv_mirror_log_ $vg/$lv1 ${lv1}_mlog
+test $(lv_mirror_log_ $vg/$lv1) = ${lv1}_mlog
# "cleanup"
check_and_cleanup_lvs_
diff --git a/test/shell/pvmove-abort.sh b/test/shell/pvmove-abort.sh
index b7e3105..09a6af2 100644
--- a/test/shell/pvmove-abort.sh
+++ b/test/shell/pvmove-abort.sh
@@ -53,8 +53,8 @@ pvmove --abort "$dev1"
# check if proper pvmove was canceled
get lv_field $vg name -a | tee out
-not grep "^pvmove0" out
-grep "^pvmove1" out
+not egrep "^\[?pvmove0" out
+egrep "^\[?pvmove1" out
fi
diff --git a/test/shell/pvmove-resume-1.sh b/test/shell/pvmove-resume-1.sh
index 8e4b6a7..5167da5 100644
--- a/test/shell/pvmove-resume-1.sh
+++ b/test/shell/pvmove-resume-1.sh
@@ -89,13 +89,13 @@ test_pvmove_resume() {
aux enable_dev "$dev4"
i=0
- while get lv_field $vg name -a | grep "^pvmove"; do
+ while get lv_field $vg name -a | egrep "^\[?pvmove"; do
# wait for 30 secs at max
test $i -ge 300 && die "Pvmove is too slow or does not progress."
sleep .1
i=$((i + 1))
done
- while get lv_field $vg1 name -a | grep "^pvmove"; do
+ while get lv_field $vg1 name -a | egrep "^\[?pvmove"; do
# wait for 30 secs at max
test $i -ge 300 && die "Pvmove is too slow or does not progress."
sleep .1
@@ -171,8 +171,8 @@ pvmove_fg() {
fi
# ...thus finish polling
- get lv_field $vg name -a | grep "^pvmove0"
- get lv_field $vg1 name -a | grep "^pvmove0"
+ get lv_field $vg name -a | egrep "^\[?pvmove0"
+ get lv_field $vg1 name -a | egrep "^\[?pvmove0"
# disable delay device
# fg pvmove would take ages to complete otherwise
@@ -196,8 +196,8 @@ pvmove_bg() {
fi
# ...thus finish polling
- get lv_field $vg name -a | grep "^pvmove0"
- get lv_field $vg1 name -a | grep "^pvmove0"
+ get lv_field $vg name -a | egrep "^\[?pvmove0"
+ get lv_field $vg1 name -a | egrep "^\[?pvmove0"
LVM_TEST_TAG="kill_me_$PREFIX" pvmove -b -i0
}
@@ -216,8 +216,8 @@ pvmove_fg_single() {
fi
# ...thus finish polling
- get lv_field $vg name -a | grep "^pvmove0"
- get lv_field $vg1 name -a | grep "^pvmove0"
+ get lv_field $vg name -a | egrep "^\[?pvmove0"
+ get lv_field $vg1 name -a | egrep "^\[?pvmove0"
# disable delay device
# fg pvmove would take ages to complete otherwise
@@ -242,8 +242,8 @@ pvmove_bg_single() {
fi
# ...thus finish polling
- get lv_field $vg name -a | grep "^pvmove0"
- get lv_field $vg1 name -a | grep "^pvmove0"
+ get lv_field $vg name -a | egrep "^\[?pvmove0"
+ get lv_field $vg1 name -a | egrep "^\[?pvmove0"
LVM_TEST_TAG="kill_me_$PREFIX" pvmove -b "$dev1"
LVM_TEST_TAG="kill_me_$PREFIX" pvmove -b "$dev2"
diff --git a/test/shell/pvmove-resume-2.sh b/test/shell/pvmove-resume-2.sh
index 374f4ff..3baa6df 100644
--- a/test/shell/pvmove-resume-2.sh
+++ b/test/shell/pvmove-resume-2.sh
@@ -129,7 +129,7 @@ pvmove_fg() {
fi
# ...thus finish polling
- get lv_field $vg name -a | grep "^pvmove0"
+ get lv_field $vg name -a | egrep "^\[?pvmove0"
aux enable_dev "$dev2"
@@ -149,7 +149,7 @@ pvmove_bg() {
fi
# ...thus finish polling
- get lv_field $vg name -a | grep "^pvmove0"
+ get lv_field $vg name -a | egrep "^\[?pvmove0"
LVM_TEST_TAG="kill_me_$PREFIX" pvmove -b
}
@@ -167,7 +167,7 @@ pvmove_fg_single() {
fi
# ...thus finish polling
- get lv_field $vg name -a | grep "^pvmove0"
+ get lv_field $vg name -a | egrep "^\[?pvmove0"
aux enable_dev "$dev2"
@@ -187,7 +187,7 @@ pvmove_bg_single() {
fi
# ...thus finish polling
- get lv_field $vg name -a | grep "^pvmove0"
+ get lv_field $vg name -a | egrep "^\[?pvmove0"
LVM_TEST_TAG="kill_me_$PREFIX" pvmove -b "$dev1"
}
diff --git a/test/shell/pvmove-resume-multiseg.sh b/test/shell/pvmove-resume-multiseg.sh
index 3898f5b..b06400c 100644
--- a/test/shell/pvmove-resume-multiseg.sh
+++ b/test/shell/pvmove-resume-multiseg.sh
@@ -15,7 +15,7 @@
# Multisegment variant w/ 2 pvmoves LVs per VG
SKIP_WITH_LVMLOCKD=1
-SKIP_WITH_CLVMD=1
+#SKIP_WITH_CLVMD=1
. lib/inittest
@@ -89,7 +89,7 @@ test_pvmove_resume() {
aux enable_dev "$dev5"
i=0
- while get lv_field $vg name -a | grep "^pvmove"; do
+ while get lv_field $vg name -a | grep "^\[?pvmove"; do
# wait for 30 secs at max
test $i -ge 300 && die "Pvmove is too slow or does not progress."
sleep .1
@@ -99,6 +99,8 @@ test_pvmove_resume() {
aux kill_tagged_processes
lvremove -ff $vg
+ # drop debug logs from killed lvm2 commands
+ rm -f debug.log_DEBUG*
}
lvchange_single() {
@@ -145,8 +147,8 @@ pvmove_fg() {
fi
# ...thus finish polling
- get lv_field $vg name -a | grep "^pvmove0"
- get lv_field $vg name -a | grep "^pvmove1"
+ get lv_field $vg name -a | egrep "^\[?pvmove0"
+ get lv_field $vg name -a | egrep "^\[?pvmove1"
# disable delay device
# fg pvmove would take ages to complete otherwise
@@ -170,8 +172,8 @@ pvmove_bg() {
fi
# ...thus finish polling
- get lv_field $vg name -a | grep "^pvmove0"
- get lv_field $vg name -a | grep "^pvmove1"
+ get lv_field $vg name -a | egrep "^\[?pvmove0"
+ get lv_field $vg name -a | egrep "^\[?pvmove1"
LVM_TEST_TAG="kill_me_$PREFIX" pvmove -b
}
@@ -190,8 +192,8 @@ pvmove_fg_single() {
fi
# ...thus finish polling
- get lv_field $vg name -a | grep "^pvmove0"
- get lv_field $vg name -a | grep "^pvmove1"
+ get lv_field $vg name -a | egrep "^\[?pvmove0"
+ get lv_field $vg name -a | egrep "^\[?pvmove1"
# disable delay device
# fg pvmove would take ages to complete otherwise
@@ -216,8 +218,8 @@ pvmove_bg_single() {
fi
# ...thus finish polling
- get lv_field $vg name -a | grep "^pvmove0"
- get lv_field $vg name -a | grep "^pvmove1"
+ get lv_field $vg name -a | egrep "^\[?pvmove0"
+ get lv_field $vg name -a | egrep "^\[?pvmove1"
LVM_TEST_TAG="kill_me_$PREFIX" pvmove -b "$dev1"
LVM_TEST_TAG="kill_me_$PREFIX" pvmove -b "$dev3"
8 years
master - cache: fix previous change and correct ()
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=4ddf5a11cf333f...
Commit: 4ddf5a11cf333fdcf45eec907e12e10c41a9d578
Parent: 17ad8848361aa16ff227038068c3d0771771f095
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Apr 22 12:31:02 2016 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Apr 22 12:52:53 2016 +0200
cache: fix previous change and correct ()
412f09ca332c644e08421e289a3e8d54890971ba missed parentheses.
---
lib/metadata/cache_manip.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/lib/metadata/cache_manip.c b/lib/metadata/cache_manip.c
index 1c51f66..46cb6a8 100644
--- a/lib/metadata/cache_manip.c
+++ b/lib/metadata/cache_manip.c
@@ -47,11 +47,10 @@ const char *get_cache_mode_name(const struct lv_segment *seg)
if (seg->feature_flags & DM_CACHE_FEATURE_WRITEBACK)
return "writeback";
- if (!seg->feature_flags & DM_CACHE_FEATURE_WRITETHROUGH) {
+ if (!(seg->feature_flags & DM_CACHE_FEATURE_WRITETHROUGH))
log_error(INTERNAL_ERROR "LV %s has uknown feature flags %" PRIu64 ", "
"returning writethrough instead.",
display_lvname(seg->lv), seg->feature_flags);
- }
return "writethrough";
}
8 years
master - libdm-stats: check for empty region and area lists
by Bryn Reeves
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=17ad8848361aa1...
Commit: 17ad8848361aa16ff227038068c3d0771771f095
Parent: 69c2f560053c0a5217592d571aa9ea03a6dbc267
Author: Bryn M. Reeves <bmr(a)redhat.com>
AuthorDate: Fri Apr 22 10:35:07 2016 +0100
Committer: Bryn M. Reeves <bmr(a)redhat.com>
CommitterDate: Fri Apr 22 10:35:07 2016 +0100
libdm-stats: check for empty region and area lists
Check that @stats_list and @stats_print returned data in the
_stats_parse_list() and _stats_parse_region() functions before
attempting to operate on region and area values.
This avoids a coverity warning since fgets() could potentially
return no data from the memory buffer returned by the ioctl.
In both cases the ioctl would return an error, preventing these
functions from running, however it is cleaner to test for the
condition explicitly and fail in those cases.
---
libdm/libdm-stats.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/libdm/libdm-stats.c b/libdm/libdm-stats.c
index 1dce3eb..f1c0560 100644
--- a/libdm/libdm-stats.c
+++ b/libdm/libdm-stats.c
@@ -680,6 +680,10 @@ static int _stats_parse_list(struct dm_stats *dms, const char *resp)
nr_regions++;
}
+ if (!nr_regions)
+ /* no region data read from @stats_list */
+ goto bad;
+
dms->nr_regions = nr_regions;
dms->max_region = max_region - 1;
dms->regions = dm_pool_end_object(mem);
@@ -936,6 +940,10 @@ static int _stats_parse_region(struct dm_stats *dms, const char *resp,
}
}
+ if (region->start == UINT64_MAX)
+ /* no area data read from @stats_print */
+ goto bad;
+
region->len = (start + len) - region->start;
region->timescale = timescale;
region->counters = dm_pool_end_object(mem);
8 years
master - tests: keep using [] for hidden volumes
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=69c2f560053c0a...
Commit: 69c2f560053c0a5217592d571aa9ea03a6dbc267
Parent: 8c4b717f4db7e3aed2a6e1f8bf7f5ecb722d35e4
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Apr 22 00:04:23 2016 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Apr 22 01:14:56 2016 +0200
tests: keep using [] for hidden volumes
Figure out which test needs to see hidden volumes without [].
But normally use [] for debug printing in tests.
It's confusing otherwise.
---
test/lib/aux.sh | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index 3a44ae6..08187b5 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -1074,7 +1074,6 @@ log/level = 9
log/overwrite = 1
log/syslog = 0
log/verbose = 0
-report/mark_hidden_devices=0
EOF
}
8 years
master - coverity: drop abadoing object
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=8c4b717f4db7e3...
Commit: 8c4b717f4db7e3aed2a6e1f8bf7f5ecb722d35e4
Parent: 0bf55186263de96c0f7377c631d27d9679d4df27
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Apr 21 20:55:23 2016 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Apr 22 01:13:35 2016 +0200
coverity: drop abadoing object
As mempool is destroyed on by caller don't bother for
mempool freeing here.
---
lib/metadata/metadata.c | 28 +++++++++++-----------------
1 files changed, 11 insertions(+), 17 deletions(-)
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index e9f5fa5..f9ce080 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -4610,10 +4610,10 @@ static int _check_devs_used_correspond_with_lv(struct dm_pool *mem, struct dm_li
found_inconsistent = 1;
} else {
if (!dm_pool_grow_object(mem, DEV_LIST_DELIM, sizeof(DEV_LIST_DELIM) - 1))
- goto_bad;
+ return_0;
}
if (!dm_pool_grow_object(mem, dev_name(dev), 0))
- goto_bad;
+ return_0;
}
}
@@ -4621,7 +4621,7 @@ static int _check_devs_used_correspond_with_lv(struct dm_pool *mem, struct dm_li
return 1;
if (!dm_pool_grow_object(mem, "\0", 1))
- goto_bad;
+ return_0;
used_devnames = dm_pool_end_object(mem);
found_inconsistent = 0;
@@ -4630,9 +4630,9 @@ static int _check_devs_used_correspond_with_lv(struct dm_pool *mem, struct dm_li
if (seg_type(seg, s) == AREA_PV) {
if (!(dev = seg_dev(seg, s))) {
log_error("Couldn't find device for segment belonging to "
- "%s/%s while checking used and assumed devices.",
- lv->vg->name, lv->name);
- goto bad;
+ "%s while checking used and assumed devices.",
+ display_lvname(lv));
+ return 0;
}
if (!(dev->flags & DEV_USED_FOR_LV)) {
if (!found_inconsistent) {
@@ -4640,10 +4640,10 @@ static int _check_devs_used_correspond_with_lv(struct dm_pool *mem, struct dm_li
found_inconsistent = 1;
} else {
if (!dm_pool_grow_object(mem, DEV_LIST_DELIM, sizeof(DEV_LIST_DELIM) - 1))
- goto_bad;
+ return_0;
}
if (!dm_pool_grow_object(mem, dev_name(dev), 0))
- goto bad;
+ return_0;
}
}
}
@@ -4651,20 +4651,14 @@ static int _check_devs_used_correspond_with_lv(struct dm_pool *mem, struct dm_li
if (found_inconsistent) {
if (!dm_pool_grow_object(mem, "\0", 1))
- goto_bad;
+ return_0;
assumed_devnames = dm_pool_end_object(mem);
}
- log_warn("WARNING: Device mismatch detected for %s/%s which is accessing %s instead of %s.",
- lv->vg->name, lv->name, used_devnames, assumed_devnames);
+ log_warn("WARNING: Device mismatch detected for %s which is accessing %s instead of %s.",
+ display_lvname(lv), used_devnames, assumed_devnames);
- /* This also frees assumed_devnames. */
- dm_pool_free(mem, (void *) used_devnames);
return 1;
-bad:
- if (found_inconsistent)
- dm_pool_abandon_object(mem);
- return 0;
}
static int _check_devs_used_correspond_with_vg(struct volume_group *vg)
8 years
master - coverity: avoid using signed types for single bits
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=0bf55186263de9...
Commit: 0bf55186263de96c0f7377c631d27d9679d4df27
Parent: 412f09ca332c644e08421e289a3e8d54890971ba
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Apr 21 20:54:54 2016 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Apr 22 01:12:34 2016 +0200
coverity: avoid using signed types for single bits
---
lib/metadata/lv.h | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/metadata/lv.h b/lib/metadata/lv.h
index da81419..08fc090 100644
--- a/lib/metadata/lv.h
+++ b/lib/metadata/lv.h
@@ -94,8 +94,8 @@ struct historical_logical_volume {
uint64_t timestamp_removed;
struct generic_logical_volume *indirect_origin;
struct dm_list indirect_glvs; /* list of struct generic_logical_volume */
- int checked:1; /* set if this historical LV has been checked for validity */
- int valid:1; /* historical LV is valid if there's at least one live LV among ancestors */
+ unsigned checked:1; /* set if this historical LV has been checked for validity */
+ unsigned valid:1; /* historical LV is valid if there's at least one live LV among ancestors */
};
struct generic_logical_volume {
8 years
master - coverity: return non-null string with internal error
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=412f09ca332c64...
Commit: 412f09ca332c644e08421e289a3e8d54890971ba
Parent: 447daa9179d94f86a972598e42eaab8b6913f3f7
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Apr 21 20:53:22 2016 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Apr 22 01:12:34 2016 +0200
coverity: return non-null string with internal error
While we return internal error we should not let tool crash on NULL
access, so return valid string for such case.
---
lib/metadata/cache_manip.c | 18 +++++++++---------
1 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/lib/metadata/cache_manip.c b/lib/metadata/cache_manip.c
index 3962247..1c51f66 100644
--- a/lib/metadata/cache_manip.c
+++ b/lib/metadata/cache_manip.c
@@ -41,19 +41,19 @@ int cache_mode_is_set(const struct lv_segment *seg)
const char *get_cache_mode_name(const struct lv_segment *seg)
{
- if (seg->feature_flags & DM_CACHE_FEATURE_WRITEBACK)
- return "writeback";
-
- if (seg->feature_flags & DM_CACHE_FEATURE_WRITETHROUGH)
- return "writethrough";
-
if (seg->feature_flags & DM_CACHE_FEATURE_PASSTHROUGH)
return "passthrough";
- log_error(INTERNAL_ERROR "LV %s has uknown feature flags %" PRIu64 ".",
- display_lvname(seg->lv), seg->feature_flags);
+ if (seg->feature_flags & DM_CACHE_FEATURE_WRITEBACK)
+ return "writeback";
+
+ if (!seg->feature_flags & DM_CACHE_FEATURE_WRITETHROUGH) {
+ log_error(INTERNAL_ERROR "LV %s has uknown feature flags %" PRIu64 ", "
+ "returning writethrough instead.",
+ display_lvname(seg->lv), seg->feature_flags);
+ }
- return NULL;
+ return "writethrough";
}
int cache_set_mode(struct lv_segment *seg, const char *str)
8 years