[PATCH 06/30] Ensure we always have origin defined

Zdenek Kabelac <[email protected]>
Newsgroups dev.linux.lists.lvm-devel
Message-ID <95e3333c3c671cabbc5a99a2bfbbc15dcf948f32.1287994529.git.zkabelac@redhat.com>
clang Logic error	Dereference of null pointer
Ensure the code path could not use origin == NULL because of internal
error in code.

Signed-off-by: Zdenek Kabelac <[email protected]>
---
 tools/lvcreate.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/tools/lvcreate.c b/tools/lvcreate.c
index de5b59c..a9e3c2d 100644
--- a/tools/lvcreate.c
+++ b/tools/lvcreate.c
@@ -179,6 +179,10 @@ static int _update_extents_params(struct volume_group *vg,
 					  lp->origin);
 				return 0;
 			}
+			if (!origin) {
+				log_error(INTERNAL_ERROR "Couldn't find origin volume.");
+				return 0;
+			}
 			lp->extents = lp->extents * origin->le_count / 100;
 			break;
 		case PERCENT_NONE:
-- 
1.7.3.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.