From patchwork Mon Mar 11 12:06:23 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: fanchaoting X-Patchwork-Id: 2248591 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 49C33DF5B1 for ; Mon, 11 Mar 2013 12:06:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753816Ab3CKMF7 (ORCPT ); Mon, 11 Mar 2013 08:05:59 -0400 Received: from cn.fujitsu.com ([222.73.24.84]:43299 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1753735Ab3CKMF7 (ORCPT ); Mon, 11 Mar 2013 08:05:59 -0400 X-IronPort-AV: E=Sophos;i="4.84,822,1355068800"; d="scan'208";a="6851676" Received: from unknown (HELO tang.cn.fujitsu.com) ([10.167.250.3]) by song.cn.fujitsu.com with ESMTP; 11 Mar 2013 20:03:28 +0800 Received: from fnstmail02.fnst.cn.fujitsu.com (tang.cn.fujitsu.com [127.0.0.1]) by tang.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id r2BC5rA6009651; Mon, 11 Mar 2013 20:05:54 +0800 Received: from [127.0.0.1] ([10.167.233.142]) by fnstmail02.fnst.cn.fujitsu.com (Lotus Domino Release 8.5.3) with ESMTP id 2013031120044249-760961 ; Mon, 11 Mar 2013 20:04:42 +0800 Message-ID: <513DC8BF.5060503@cn.fujitsu.com> Date: Mon, 11 Mar 2013 20:06:23 +0800 From: fanchaoting User-Agent: Thunderbird 2.0.0.9 (Windows/20071031) MIME-Version: 1.0 To: bhalevy@tonian.com CC: "linux-nfs@vger.kernel.org" Subject: [PATCH] ctl: should return NULL when dmsetup fail in find_dm_name X-MIMETrack: Itemize by SMTP Server on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2013/03/11 20:04:42, Serialize by Router on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2013/03/11 20:04:43, Serialize complete at 2013/03/11 20:04:43 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org 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 --- ctl.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) -- 1.7.1 -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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');