From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pekka Enberg Subject: Re: [PATCH] kvm tools: Fix segfault when failing to initialize KVM Date: Wed, 1 Feb 2012 09:26:00 +0200 (EET) Message-ID: References: <1328062060-17262-1-git-send-email-levinsasha928@gmail.com> <20120201071905.GA1924@moon> Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: Sasha Levin , mingo@elte.hu, asias.hejun@gmail.com, kvm@vger.kernel.org To: Cyrill Gorcunov Return-path: Received: from mail-lpp01m010-f46.google.com ([209.85.215.46]:57697 "EHLO mail-lpp01m010-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752859Ab2BAH0F (ORCPT ); Wed, 1 Feb 2012 02:26:05 -0500 Received: by lagu2 with SMTP id u2so488798lag.19 for ; Tue, 31 Jan 2012 23:26:04 -0800 (PST) In-Reply-To: <20120201071905.GA1924@moon> Sender: kvm-owner@vger.kernel.org List-ID: On Wed, 1 Feb 2012, Cyrill Gorcunov wrote: > I suspect we need something like > --- > tools/kvm/builtin-run.c | 5 +++++ > tools/kvm/kvm.c | 2 +- > 2 files changed, 6 insertions(+), 1 deletion(-) > > Index: linux-2.6.git/tools/kvm/builtin-run.c > =================================================================== > --- linux-2.6.git.orig/tools/kvm/builtin-run.c > +++ linux-2.6.git/tools/kvm/builtin-run.c > @@ -997,6 +997,11 @@ static int kvm_cmd_run_init(int argc, co > } > > kvm = kvm__init(dev, hugetlbfs_path, ram_size, guest_name); > + if (IS_ERR(kvm)) { > + r = (int)PTR_ERR(kvm); The cast is not needed. > + pr_err("Can't initialize KVM, failed with error %d\n", r); > + goto fail; > + }