public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
From: jbrassow@sourceware.org
To: lvm-devel@redhat.com, lvm2-cvs@sourceware.org
Subject: LVM2 lib/metadata/raid_manip.c libdm/libdm-dep ...
Date: Thu, 11 Aug 2011 19:17:00 -0000	[thread overview]
Message-ID: <20110811191711.22579.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	jbrassow@sourceware.org	2011-08-11 19:17:10

Modified files:
	lib/metadata   : raid_manip.c 
	libdm          : libdm-deptree.c 

Log message:
	Add some log_error msg's and fix potential segfault
	
	Thanks to kabi for spotting these - especially the possibility for
	segfault if a loop runs all the way through without finding a match.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/raid_manip.c.diff?cvsroot=lvm2&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdm-deptree.c.diff?cvsroot=lvm2&r1=1.103&r2=1.104

--- LVM2/lib/metadata/raid_manip.c	2011/08/11 18:24:41	1.1
+++ LVM2/lib/metadata/raid_manip.c	2011/08/11 19:17:10	1.2
@@ -179,16 +179,20 @@
 
 		/* Alter rmeta name */
 		shift_name = dm_pool_strdup(cmd->mem, seg_metalv(seg, s)->name);
-		if (!shift_name)
-			return_0;
+		if (!shift_name) {
+			log_error("Memory allocation failed.");
+			return 0;
+		}
 		len = strlen(shift_name) - 1;
 		shift_name[len] -= missing;
 		seg_metalv(seg, s)->name = shift_name;
 
 		/* Alter rimage name */
 		shift_name = dm_pool_strdup(cmd->mem, seg_lv(seg, s)->name);
-		if (!shift_name)
-			return_0;
+		if (!shift_name) {
+			log_error("Memory allocation failed.");
+			return 0;
+		}
 		len = strlen(shift_name) - 1;
 		shift_name[len] -= missing;
 		seg_lv(seg, s)->name = shift_name;
--- LVM2/libdm/libdm-deptree.c	2011/08/02 22:07:23	1.103
+++ LVM2/libdm/libdm-deptree.c	2011/08/11 19:17:10	1.104
@@ -2356,6 +2356,9 @@
 						 dm_segtypes[i].type, size)))
 				return_0;
 
+	if (!seg)
+		return_0;
+
 	seg->region_size = region_size;
 	seg->stripe_size = stripe_size;
 	seg->area_count = 0;


                 reply	other threads:[~2011-08-11 19:17 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110811191711.22579.qmail@sourceware.org \
    --to=jbrassow@sourceware.org \
    --cc=lvm-devel@redhat.com \
    --cc=lvm2-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).