master - libdm: put in secure check
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=d74e1291cd43f5...
Commit: d74e1291cd43f50010c22fb2c071d92390a26d28
Parent: 0128770d6d881c7f30fc5e22137d1b20ce003e13
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Nov 11 22:51:23 2015 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Nov 13 11:17:05 2015 +0100
libdm: put in secure check
Coverity complains about NULL deref - while this cannot currently
happen, put in secure INTERNAL_ERROR.
---
libdm/libdm-report.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/libdm/libdm-report.c b/libdm/libdm-report.c
index b9906d8..38dde07 100644
--- a/libdm/libdm-report.c
+++ b/libdm/libdm-report.c
@@ -3527,6 +3527,10 @@ static struct field_selection *_create_field_selection(struct dm_report *rh,
}
break;
case DM_REPORT_FIELD_TYPE_STRING_LIST:
+ if (!custom) {
+ log_error(INTERNAL_ERROR "Custom selection list is undefined.");
+ goto error;
+ }
fs->value->v.l = *(struct selection_str_list **)custom;
if (_check_value_is_strictly_reserved(rh, field_num, DM_REPORT_FIELD_TYPE_STRING_LIST, fs->value->v.l, NULL)) {
log_error("String list value found in selection is reserved.");
8 years, 6 months
master - reporter: add missing stack trace
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=0128770d6d881c...
Commit: 0128770d6d881c7f30fc5e22137d1b20ce003e13
Parent: 43777b551d840a55d70e862bff751e7208c8eaf4
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Nov 11 22:07:39 2015 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Nov 13 11:17:05 2015 +0100
reporter: add missing stack trace
Use goto_out on error paths.
---
tools/reporter.c | 13 ++++++-------
1 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/tools/reporter.c b/tools/reporter.c
index 2c733e3..71f20a3 100644
--- a/tools/reporter.c
+++ b/tools/reporter.c
@@ -657,9 +657,8 @@ static int _get_report_options(struct cmd_context *cmd,
int r = ECMD_PROCESSED;
if (!(mem = dm_pool_create("report_options", 128))) {
- r = ECMD_FAILED;
log_error("Failed to create temporary mempool to process report options.");
- goto_out;
+ return ECMD_FAILED;
}
if (!(final_opts_list = str_to_str_list(mem, *options, ",", 1))) {
@@ -704,24 +703,24 @@ static int _get_report_options(struct cmd_context *cmd,
default:
if (!(final_opts_list = str_to_str_list(mem, opts, ",", 1))) {
r = ECMD_FAILED;
- goto out;
+ goto_out;
}
}
}
if (!(*options = str_list_to_str(cmd->mem, final_opts_list, ","))) {
r = ECMD_FAILED;
- goto out;
+ goto_out;
}
if (final_compact_list &&
!(*fields_to_compact = str_list_to_str(cmd->mem, final_compact_list, ","))) {
dm_pool_free(cmd->mem, (char *) *options);
r = ECMD_FAILED;
- goto out;
+ goto_out;
}
out:
- if (mem)
- dm_pool_destroy(mem);
+ dm_pool_destroy(mem);
+
return r;
}
8 years, 6 months
master - lvmetad: tail chasing to shut up coverity
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=43777b551d840a...
Commit: 43777b551d840a55d70e862bff751e7208c8eaf4
Parent: 058725c72149e9f852390ca1d52e932ddb745a82
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu Nov 12 09:35:41 2015 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Nov 12 09:35:41 2015 -0600
lvmetad: tail chasing to shut up coverity
---
daemons/lvmetad/lvmetad-core.c | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/daemons/lvmetad/lvmetad-core.c b/daemons/lvmetad/lvmetad-core.c
index 781cfc6..f7df5fd 100644
--- a/daemons/lvmetad/lvmetad-core.c
+++ b/daemons/lvmetad/lvmetad-core.c
@@ -1346,8 +1346,14 @@ static int _update_metadata(lvmetad_state *s, const char *arg_name, const char *
int abort_daemon = 0;
int retval = 0;
+ if (!arg_vgid || !arg_name) {
+ ERROR(s, "update_metadata missing args arg_vgid %s arg_name %s pvid %s",
+ arg_vgid ?: "none", arg_name ?: "none", pvid ?: "none");
+ return 0;
+ }
+
DEBUGLOG(s, "update_metadata begin arg_vgid %s arg_name %s pvid %s",
- arg_vgid ?: "none", arg_name ?: "none", pvid ?: "none");
+ arg_vgid, arg_name, pvid ?: "none");
/*
* Begin by figuring out what has changed:
@@ -1378,7 +1384,7 @@ static int _update_metadata(lvmetad_state *s, const char *arg_name, const char *
* A lookup of the name arg was successful in finding arg_vgid_lookup,
* but that resulting vgid doesn't match the arg_vgid.
*/
- if (arg_vgid_lookup && arg_vgid && strcmp(arg_vgid_lookup, arg_vgid)) {
+ if (arg_vgid_lookup && strcmp(arg_vgid_lookup, arg_vgid)) {
if (arg_name_lookup) {
/*
* This shouldn't happen.
@@ -1419,7 +1425,7 @@ static int _update_metadata(lvmetad_state *s, const char *arg_name, const char *
* A lookup of the vgid arg was successful in finding arg_name_lookup,
* but that resulting name doesn't match the arg_name.
*/
- if (arg_name_lookup && arg_name && strcmp(arg_name_lookup, arg_name)) {
+ if (arg_name_lookup && strcmp(arg_name_lookup, arg_name)) {
if (arg_vgid_lookup) {
/*
* This shouldn't happen.
8 years, 6 months
master - dmeventd: fix check for failing open.
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=058725c72149e9...
Commit: 058725c72149e9f852390ca1d52e932ddb745a82
Parent: 1e729c47d2cdc6591a41f159f84be39ffcc6c200
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Nov 11 19:54:08 2015 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Nov 11 19:54:55 2015 +0100
dmeventd: fix check for failing open.
Recent change 2c8d6f5c90d5be62b48ba2881f2a6631091dc5af
actually droped restart when the reason of failing open is missing
device completely - check for ENOENT now as another reason
to start new dmeventd server (when there is no systemd to maintain it).
---
daemons/dmeventd/libdevmapper-event.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/daemons/dmeventd/libdevmapper-event.c b/daemons/dmeventd/libdevmapper-event.c
index 359dfdd..f1441f5 100644
--- a/daemons/dmeventd/libdevmapper-event.c
+++ b/daemons/dmeventd/libdevmapper-event.c
@@ -425,7 +425,7 @@ static int _start_daemon(char *dmeventd_path, struct dm_event_fifos *fifos)
if (close(fifos->client))
log_sys_debug("close", fifos->client_path);
return 1;
- } else if (errno != ENXIO) {
+ } else if (errno != ENXIO && errno != ENOENT) {
/* problem */
log_sys_error("open", fifos->client_path);
return 0;
8 years, 6 months
master - str_list: do not support str lists without mempools
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=1e729c47d2cdc6...
Commit: 1e729c47d2cdc6591a41f159f84be39ffcc6c200
Parent: b8779e706e1019a8e8212d81bde0cc7e42be5426
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Wed Nov 11 16:09:39 2015 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Wed Nov 11 16:09:52 2015 +0100
str_list: do not support str lists without mempools
Do not support str lists without mempools. Instead, create temporary
mempool where necessary (currently only _get_report_options fn).
---
lib/datastruct/str_list.c | 23 ++++-------------------
lib/datastruct/str_list.h | 2 --
tools/reporter.c | 32 +++++++++++++-------------------
3 files changed, 17 insertions(+), 40 deletions(-)
diff --git a/lib/datastruct/str_list.c b/lib/datastruct/str_list.c
index f056b85..cf7457b 100644
--- a/lib/datastruct/str_list.c
+++ b/lib/datastruct/str_list.c
@@ -20,8 +20,7 @@ struct dm_list *str_list_create(struct dm_pool *mem)
{
struct dm_list *sl;
- if (!(sl = mem ? dm_pool_alloc(mem, sizeof(struct dm_list))
- : dm_malloc(sizeof(struct dm_list)))) {
+ if (!(sl = dm_pool_alloc(mem, sizeof(struct dm_list)))) {
log_errno(ENOMEM, "str_list allocation failed");
return NULL;
}
@@ -38,8 +37,7 @@ static int _str_list_add_no_dup_check(struct dm_pool *mem, struct dm_list *sll,
if (!str)
return_0;
- if (!(sln = mem ? dm_pool_alloc(mem, sizeof(*sln))
- : dm_malloc(sizeof(*sln))))
+ if (!(sln = dm_pool_alloc(mem, sizeof(*sln))))
return_0;
sln->str = str;
@@ -176,7 +174,7 @@ char *str_list_to_str(struct dm_pool *mem, const struct dm_list *list,
if (list_size > 1)
len += ((list_size - 1) * delim_len);
- str = mem ? dm_pool_alloc(mem, len+1) : dm_malloc(len+1);
+ str = dm_pool_alloc(mem, len+1);
if (!str) {
log_error("str_list_to_str: string allocation failed.");
return NULL;
@@ -220,7 +218,7 @@ struct dm_list *str_to_str_list(struct dm_pool *mem, const char *str,
next = p2 + delim_len;
len = p2 - p1;
- str_item = mem ? dm_pool_alloc(mem, len+1) : dm_malloc(len+1);
+ str_item = dm_pool_alloc(mem, len+1);
if (!str_item) {
log_error("str_to_str_list: string list item allocation failed.");
goto bad;
@@ -245,16 +243,3 @@ bad:
dm_pool_free(mem, list);
return NULL;
}
-
-void str_list_destroy(struct dm_list *list, int deallocate_strings)
-{
- struct dm_str_list *sl, *tmp_sl;
-
- dm_list_iterate_items_safe(sl, tmp_sl, list) {
- dm_list_del(&sl->list);
- if (deallocate_strings)
- dm_free((char *)sl->str);
- dm_free(sl);
- }
- dm_free(list);
-}
diff --git a/lib/datastruct/str_list.h b/lib/datastruct/str_list.h
index 92ff8c5..268a3cf 100644
--- a/lib/datastruct/str_list.h
+++ b/lib/datastruct/str_list.h
@@ -32,7 +32,5 @@ int str_list_dup(struct dm_pool *mem, struct dm_list *sllnew,
const struct dm_list *sllold);
char *str_list_to_str(struct dm_pool *mem, const struct dm_list *list, const char *delim);
struct dm_list *str_to_str_list(struct dm_pool *mem, const char *str, const char *delim, int ignore_multiple_delim);
-/* Only for lists which were *not* allocated from the mem pool! */
-void str_list_destroy(struct dm_list *list, int deallocate_strings);
#endif
diff --git a/tools/reporter.c b/tools/reporter.c
index 89024c2..2c733e3 100644
--- a/tools/reporter.c
+++ b/tools/reporter.c
@@ -651,13 +651,18 @@ static int _get_report_options(struct cmd_context *cmd,
struct dm_list *final_opts_list;
struct dm_list *final_compact_list = NULL;
struct dm_list *opts_list = NULL;
- int opts_list_destroy = 1;
struct dm_str_list *sl;
const char *opts;
+ struct dm_pool *mem;
int r = ECMD_PROCESSED;
+ if (!(mem = dm_pool_create("report_options", 128))) {
+ r = ECMD_FAILED;
+ log_error("Failed to create temporary mempool to process report options.");
+ goto_out;
+ }
- if (!(final_opts_list = str_to_str_list(NULL, *options, ",", 1))) {
+ if (!(final_opts_list = str_to_str_list(mem, *options, ",", 1))) {
r = ECMD_FAILED;
goto_out;
}
@@ -679,7 +684,7 @@ static int _get_report_options(struct cmd_context *cmd,
case '-':
/* fall through */
case '#':
- if (!(opts_list = str_to_str_list(NULL, opts + 1, ",", 1))) {
+ if (!(opts_list = str_to_str_list(mem, opts + 1, ",", 1))) {
r = ECMD_FAILED;
goto_out;
}
@@ -690,21 +695,14 @@ static int _get_report_options(struct cmd_context *cmd,
_del_option_from_list(final_opts_list, prefix,
prefix_len, sl->str);
} else if (*opts == '#') {
- if (!final_compact_list) {
+ if (!final_compact_list)
final_compact_list = opts_list;
- opts_list_destroy = 0;
- } else
+ else
dm_list_splice(final_compact_list, opts_list);
}
- if (opts_list_destroy)
- str_list_destroy(opts_list, 1);
- else
- opts_list_destroy = 1;
- opts_list = NULL;
break;
default:
- str_list_destroy(final_opts_list, 1);
- if (!(final_opts_list = str_to_str_list(NULL, opts, ",", 1))) {
+ if (!(final_opts_list = str_to_str_list(mem, opts, ",", 1))) {
r = ECMD_FAILED;
goto out;
}
@@ -722,12 +720,8 @@ static int _get_report_options(struct cmd_context *cmd,
goto out;
}
out:
- if (opts_list)
- str_list_destroy(final_opts_list, 1);
- if (final_compact_list)
- str_list_destroy(final_compact_list, 1);
- if (final_opts_list)
- str_list_destroy(final_opts_list, 1);
+ if (mem)
+ dm_pool_destroy(mem);
return r;
}
8 years, 6 months
master - configure: check for udev_device_get_is_initialized is available
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=b8779e706e1019...
Commit: b8779e706e1019a8e8212d81bde0cc7e42be5426
Parent: f82e0210b7cb9f3926ef5051ca34a4ad383ba271
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Wed Nov 11 15:15:34 2015 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Wed Nov 11 15:15:50 2015 +0100
configure: check for udev_device_get_is_initialized is available
The udev_device_get_is_initialized is available since libudev version
165. Older versions are still used somewhere (e.g. RHEL6). So better
check for this fn and use it only if it's available.
---
aclocal.m4 | 2 +-
configure | 44 ++++++++++++++++++++++++++++++++++++++++++++
configure.in | 4 ++++
include/configure.h.in | 3 +++
lib/device/dev-ext.c | 2 ++
5 files changed, 54 insertions(+), 1 deletions(-)
diff --git a/aclocal.m4 b/aclocal.m4
index 67b2d59..05e0ad5 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -15,7 +15,7 @@ m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun
# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
# serial 1 (pkg-config-0.24)
#
-# Copyright (c) 2004 Scott James Remnant <scott(a)netsplit.com>.
+# Copyright © 2004 Scott James Remnant <scott(a)netsplit.com>.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/configure b/configure
index c566466..8a9482d 100755
--- a/configure
+++ b/configure
@@ -12007,6 +12007,50 @@ fi
$as_echo "#define UDEV_SYNC_SUPPORT 1" >>confdefs.h
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for udev_device_get_is_initialized in -ludev" >&5
+$as_echo_n "checking for udev_device_get_is_initialized in -ludev... " >&6; }
+if ${ac_cv_lib_udev_udev_device_get_is_initialized+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ludev $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char udev_device_get_is_initialized ();
+int
+main ()
+{
+return udev_device_get_is_initialized ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_udev_udev_device_get_is_initialized=yes
+else
+ ac_cv_lib_udev_udev_device_get_is_initialized=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_udev_udev_device_get_is_initialized" >&5
+$as_echo "$ac_cv_lib_udev_udev_device_get_is_initialized" >&6; }
+if test "x$ac_cv_lib_udev_udev_device_get_is_initialized" = xyes; then :
+
+$as_echo "#define HAVE_LIBUDEV_UDEV_DEVICE_GET_IS_INITIALIZED 1" >>confdefs.h
+
+fi
+
+ LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable installation of udev rules required for synchronisation" >&5
diff --git a/configure.in b/configure.in
index 68bd341..8e04782 100644
--- a/configure.in
+++ b/configure.in
@@ -1334,6 +1334,10 @@ if test "$UDEV_SYNC" = yes; then
pkg_config_init
PKG_CHECK_MODULES(UDEV, libudev >= 143, [UDEV_PC="libudev"])
AC_DEFINE([UDEV_SYNC_SUPPORT], 1, [Define to 1 to enable synchronisation with udev processing.])
+
+ AC_CHECK_LIB(udev, udev_device_get_is_initialized, AC_DEFINE([HAVE_LIBUDEV_UDEV_DEVICE_GET_IS_INITIALIZED], 1,
+ [Define to 1 if udev_device_get_is_initialized is available.]))
+ LIBS=$ac_check_lib_save_LIBS
fi
dnl -- Enable udev rules
diff --git a/include/configure.h.in b/include/configure.h.in
index cb7771f..1681af0 100644
--- a/include/configure.h.in
+++ b/include/configure.h.in
@@ -258,6 +258,9 @@
/* Define to 1 if you have the <libintl.h> header file. */
#undef HAVE_LIBINTL_H
+/* Define to 1 if udev_device_get_is_initialized is available. */
+#undef HAVE_LIBUDEV_UDEV_DEVICE_GET_IS_INITIALIZED
+
/* Define to 1 if you have the <limits.h> header file. */
#undef HAVE_LIMITS_H
diff --git a/lib/device/dev-ext.c b/lib/device/dev-ext.c
index 22e9a6d..e8cc012 100644
--- a/lib/device/dev-ext.c
+++ b/lib/device/dev-ext.c
@@ -60,11 +60,13 @@ static struct dev_ext *_dev_ext_get_udev(struct device *dev)
if (!(udev_device = udev_device_new_from_devnum(udev, 'b', dev->dev)))
return_NULL;
+#ifdef HAVE_LIBUDEV_UDEV_DEVICE_GET_IS_INITIALIZED
if (!udev_device_get_is_initialized(udev_device)) {
/* Timeout or some other udev db inconsistency! */
log_error("Udev database has incomplete information about device %s.", dev_name(dev));
return NULL;
}
+#endif
dev->ext.handle = (void *) udev_device;
return &dev->ext;
8 years, 6 months
master - dev-ext: issue error if external_device_info_source=udev and udev db record incomplete
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=f82e0210b7cb9f...
Commit: f82e0210b7cb9f3926ef5051ca34a4ad383ba271
Parent: 6d0db97163125b6f4c7e07b6aba2f27dd050d14b
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Wed Nov 11 13:13:54 2015 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Wed Nov 11 13:14:07 2015 +0100
dev-ext: issue error if external_device_info_source=udev and udev db record incomplete
Udev db records are marked as not initialized (incomplete) on timeout.
Issue an error message whenever LVM finds such records so users are
aware that something's going wrong with udev db.
This is important in case we use devices/external_device_info_source="udev"
where udev database records are used to do various filtering decisions.
For example:
udev log of timed out worker:
Nov 11 13:02:25 raw.virt systemd-udevd[607]: seq 1997 '/devices/virtual/block/dm-2' is taking a long time
Nov 11 13:04:25 raw.virt systemd-udevd[607]: seq 1997 '/devices/virtual/block/dm-2' killed
Nov 11 13:04:25 raw.virt systemd-udevd[607]: worker [11221] terminated by signal 9 (Killed)
Nov 11 13:04:25 raw.virt systemd-udevd[607]: worker [11221] failed while handling '/devices/virtual/block/dm-2'
...
LVM also issues error message visibly if incomplete udev db record is found,
devices/external_device_info_source="udev" is set:
$ pvs
Udev database has incomplete information about device /dev/dm-2.
Failed to get external handle for device /dev/dm-2 [udev].
...
---
WHATS_NEW | 1 +
lib/device/dev-ext.c | 6 ++++++
2 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 5938a99..2dea99c 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.135 -
====================================
+ Issue error if external_device_info_source=udev and udev db record incomplete.
Fix passing of 32bit values through daemons (mostly lvmlockd).
Use local memory pool for whole alloc_handle manipulation.
Add missing pointer validation after dm_get_next_target().
diff --git a/lib/device/dev-ext.c b/lib/device/dev-ext.c
index 8f2024e..22e9a6d 100644
--- a/lib/device/dev-ext.c
+++ b/lib/device/dev-ext.c
@@ -60,6 +60,12 @@ static struct dev_ext *_dev_ext_get_udev(struct device *dev)
if (!(udev_device = udev_device_new_from_devnum(udev, 'b', dev->dev)))
return_NULL;
+ if (!udev_device_get_is_initialized(udev_device)) {
+ /* Timeout or some other udev db inconsistency! */
+ log_error("Udev database has incomplete information about device %s.", dev_name(dev));
+ return NULL;
+ }
+
dev->ext.handle = (void *) udev_device;
return &dev->ext;
#else
8 years, 6 months
master - libdm: reorder error path
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=6d0db97163125b...
Commit: 6d0db97163125b6f4c7e07b6aba2f27dd050d14b
Parent: a45cc0fe1460168f2e193c210aabaa1292fe0ea3
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Nov 10 21:34:31 2015 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Nov 10 21:41:47 2015 +0100
libdm: reorder error path
Coverity noticed recent fix of an error path missed to
release 'dmt' - reoder code to ensure 'dmt' is released.
---
libdm/libdm-stats.c | 9 ++++-----
1 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/libdm/libdm-stats.c b/libdm/libdm-stats.c
index 1811e8a..3a21093 100644
--- a/libdm/libdm-stats.c
+++ b/libdm/libdm-stats.c
@@ -1270,13 +1270,12 @@ char *dm_stats_print_region(struct dm_stats *dms, uint64_t region_id,
return_0;
if (!(response = dm_task_get_message_response(dmt)))
- return_0;
-
- resp = dm_pool_strdup(dms->mem, response);
- dm_task_destroy(dmt);
+ goto_out;
- if (!resp)
+ if (!(resp = dm_pool_strdup(dms->mem, response)))
log_error("Could not allocate memory for response buffer.");
+out:
+ dm_task_destroy(dmt);
return resp;
}
8 years, 6 months
master - raid: fix the string compare
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=a45cc0fe146016...
Commit: a45cc0fe1460168f2e193c210aabaa1292fe0ea3
Parent: 59905100d1326bc651a3b5991fdaed563abcf41e
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Nov 10 21:32:46 2015 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Nov 10 21:40:28 2015 +0100
raid: fix the string compare
Coverity noticed this condition is always false and the error
path could never be visited.
So check for all mismatches of supported messages
and actually mark log_error as internal error.
---
lib/activate/dev_manager.c | 16 ++++++++--------
1 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index 0b24f86..fd4d842 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -1410,14 +1410,14 @@ int dev_manager_raid_message(struct dev_manager *dm,
}
/* These are the supported RAID messages for dm-raid v1.5.0 */
- if (!strcmp(msg, "idle") &&
- !strcmp(msg, "frozen") &&
- !strcmp(msg, "resync") &&
- !strcmp(msg, "recover") &&
- !strcmp(msg, "check") &&
- !strcmp(msg, "repair") &&
- !strcmp(msg, "reshape")) {
- log_error("Unknown RAID message: %s", msg);
+ if (strcmp(msg, "idle") &&
+ strcmp(msg, "frozen") &&
+ strcmp(msg, "resync") &&
+ strcmp(msg, "recover") &&
+ strcmp(msg, "check") &&
+ strcmp(msg, "repair") &&
+ strcmp(msg, "reshape")) {
+ log_error(INTERNAL_ERROR "Unknown RAID message: %s", msg);
return 0;
}
8 years, 6 months
master - coverity: Add placeholder modelling file.
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=59905100d1326b...
Commit: 59905100d1326bc651a3b5991fdaed563abcf41e
Parent: fb59847a0fe766ccddf5c3a57e2a0033077d62a2
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Tue Nov 10 01:37:11 2015 +0000
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Tue Nov 10 01:37:11 2015 +0000
coverity: Add placeholder modelling file.
---
coverity/coverity_model.c | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/coverity/coverity_model.c b/coverity/coverity_model.c
new file mode 100644
index 0000000..8f54e1f
--- /dev/null
+++ b/coverity/coverity_model.c
@@ -0,0 +1,14 @@
+/*
+ * Copyright (C) 2015 Red Hat, Inc. All rights reserved.
+ *
+ * This file is part of LVM2.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU General Public License v.2.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
8 years, 6 months