public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
From: prajnoha@sourceware.org
To: lvm-devel@redhat.com, lvm2-cvs@sourceware.org
Subject: LVM2/lib cache/lvmetad.c format_text/format-text.c
Date: Tue, 10 Apr 2012 12:26:00 -0000	[thread overview]
Message-ID: <20120410122629.30836.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	prajnoha@sourceware.org	2012-04-10 12:26:27

Modified files:
	lib/cache      : lvmetad.c 
	lib/format_text: format-text.c 

Log message:
	Check if info struct returned is not NULL.
	
	Just some missing checks revealed by Coverity in recent code.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/cache/lvmetad.c.diff?cvsroot=lvm2&r1=1.19&r2=1.20
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/format-text.c.diff?cvsroot=lvm2&r1=1.199&r2=1.200

--- LVM2/lib/cache/lvmetad.c	2012/03/14 17:15:22	1.19
+++ LVM2/lib/cache/lvmetad.c	2012/04/10 12:26:27	1.20
@@ -138,8 +138,9 @@
 	if (!vgname)
 		vgname = fmt->orphan_vg_name;
 
-	info = lvmcache_add(fmt->labeller, (const char *)&pvid, device,
-			    vgname, (const char *)&vgid, 0);
+	if (!(info = lvmcache_add(fmt->labeller, (const char *)&pvid, device,
+				  vgname, (const char *)&vgid, 0)))
+		return_NULL;
 
 	lvmcache_get_label(info)->sector = label_sector;
 	lvmcache_set_device_size(info, devsize);
--- LVM2/lib/format_text/format-text.c	2012/03/02 20:46:37	1.199
+++ LVM2/lib/format_text/format-text.c	2012/04/10 12:26:27	1.200
@@ -1455,6 +1455,9 @@
 		info = label->info;
 	}
 
+	if (!info)
+		return_0;
+
 	if (!lvmcache_populate_pv_fields(info, pv, scan_label_only))
 		return 0;
 


                 reply	other threads:[~2012-04-10 12:26 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=20120410122629.30836.qmail@sourceware.org \
    --to=prajnoha@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).