All of lore.kernel.org
 help / color / mirror / Atom feed
From: fanchaoting <fanchaoting@cn.fujitsu.com>
To: bhalevy@tonian.com
Cc: "linux-nfs@vger.kernel.org" <linux-nfs@vger.kernel.org>
Subject: [PATCH] ctl: should return NULL when dmsetup fail in find_dm_name
Date: Mon, 11 Mar 2013 20:06:23 +0800	[thread overview]
Message-ID: <513DC8BF.5060503@cn.fujitsu.com> (raw)

when dmsetup fail in find_dm_name, it should return NULL,if don't
do it. it will cause core dump in get_dm when do free(name).

Signed-off-by: fanchaoting<fanchaoting@cn.fujitsu.com>

---
 ctl.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/ctl.c b/ctl.c
index 2071b0e..0ac1c44 100644
--- a/ctl.c
+++ b/ctl.c
@@ -489,7 +489,7 @@ find_dm_name(int major, int minor)
        if (((fd = get_output("/sbin/dmsetup", argv)) == -1) ||
            ((fp = fdopen(fd, "r")) == NULL)) {
                printf("%s: get_output/fdopen failed\n", __func__);
-               return;
+               return NULL;
        }
        while (fgets(buf, sizeof (buf), fp) != NULL) {
                t = __token_init(buf, '\t');
--
1.7.1


             reply	other threads:[~2013-03-11 12:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-11 12:06 fanchaoting [this message]
2013-03-25  9:34 ` [PATCH] ctl: should return NULL when dmsetup fail in find_dm_name Benny Halevy
2013-03-25 10:03   ` fanchaoting

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=513DC8BF.5060503@cn.fujitsu.com \
    --to=fanchaoting@cn.fujitsu.com \
    --cc=bhalevy@tonian.com \
    --cc=linux-nfs@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.