From patchwork Wed Jul 13 13:26:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 647923 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3rqKb249kYz9sCZ for ; Wed, 13 Jul 2016 23:35:26 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=cCt7Okgl; dkim-atps=neutral Received: from localhost ([::1]:47559 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bNKJw-0003JD-7u for incoming@patchwork.ozlabs.org; Wed, 13 Jul 2016 09:35:24 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52130) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bNKBU-0001os-HL for qemu-devel@nongnu.org; Wed, 13 Jul 2016 09:26:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bNKBT-00039V-8m for qemu-devel@nongnu.org; Wed, 13 Jul 2016 09:26:40 -0400 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:35886) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bNKBT-00039Q-1w for qemu-devel@nongnu.org; Wed, 13 Jul 2016 09:26:39 -0400 Received: by mail-wm0-x242.google.com with SMTP id x83so5864778wma.3 for ; Wed, 13 Jul 2016 06:26:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=bynqcC7G96cxSq+AajuzXdMPCmElVJtdU8+T5Vp2hvA=; b=cCt7Okgl+klfyxavua4YH1A0w4mCib5pqJo78lwQ6X6Q2asdPfPyhGqbCEm4BN80V1 Z4SAvSmizHZgUZSx8ZG1A6317GCSL4urcVsoSQicEBEfAGpCXKrdTUTN6NDirhxY/Mtk YycryiYMPB59nwLBuqbtstjDJ9yGbRJz9Xcg6ERy3uS2lRCv7DzzqIjm7GYeJNKBXZzU ++yujNNxOqN+/Kh7T17XtxZOcchGmIqAKuSlVV9/2G2TBnbmQRzaxICY5xG67TTYyVaN 03kAt7jfO5j0bD+j07z5T57fwu0jPgngmp2JZxgyZ5g3ENjOrYywKsRJ32InKNtjf8io gq/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=bynqcC7G96cxSq+AajuzXdMPCmElVJtdU8+T5Vp2hvA=; b=k4Wb0xpgYvfK2xFiKvlGp+FaGrUNjXeNn+3YSzvmpbDyOa3Mdl4UmiTGCSuVCu3Som aaSKUg/HtsbFu9py6E+jcmJzGk6jrmS/BsY1mklTpjy8phZP4CDfe0B6AOHrufOGnH9V 7YEgOtSNLglhWwLOfSkWP1O+AInFfhAKrmuQ08Hl9TI3q5jTIECfhmIg22iqx79P8bd0 DOl8y6vvYzH7IktMW7xqka14fpGdua3rBRe9lNfao7udTKPpSX9qH1F6fA7/6PFNJruF 4jcTBnxbdt9j6bknUb3+hY8YUIWHnMDWw07pAyl83Gn4yxrbvL+GLdvDp1IB3mc8THc9 TbKQ== X-Gm-Message-State: ALyK8tJUMKO06JEIsf0lIQ87DSNxuqhqsqxnG5dy3BPGhpJsKdloHYu1mb9bl0PowXUnXA== X-Received: by 10.194.19.200 with SMTP id h8mr949163wje.135.1468416398279; Wed, 13 Jul 2016 06:26:38 -0700 (PDT) Received: from 640k.lan (94-39-188-118.adsl-ull.clienti.tiscali.it. [94.39.188.118]) by smtp.gmail.com with ESMTPSA id 207sm32565872wmb.7.2016.07.13.06.26.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Jul 2016 06:26:37 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 13 Jul 2016 15:26:22 +0200 Message-Id: <1468416392-120170-5-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1468416392-120170-1-git-send-email-pbonzini@redhat.com> References: <1468416392-120170-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::242 Subject: [Qemu-devel] [PULL 04/14] main-loop: check return value before using pointer X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Cao jin Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Cao jin pointer 'qemu_aio_context' should be checked first before it is used. qemu_bh_new() will use it. Signed-off-by: Cao jin Message-Id: <1467799740-26079-2-git-send-email-caoj.fnst@cn.fujitsu.com> Signed-off-by: Paolo Bonzini --- main-loop.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main-loop.c b/main-loop.c index 89a6994..6a7f8d3 100644 --- a/main-loop.c +++ b/main-loop.c @@ -154,11 +154,11 @@ int qemu_init_main_loop(Error **errp) } qemu_aio_context = aio_context_new(&local_error); - qemu_notify_bh = qemu_bh_new(notify_event_cb, NULL); if (!qemu_aio_context) { error_propagate(errp, local_error); return -EMFILE; } + qemu_notify_bh = qemu_bh_new(notify_event_cb, NULL); gpollfds = g_array_new(FALSE, FALSE, sizeof(GPollFD)); src = aio_get_g_source(qemu_aio_context); g_source_attach(src, NULL);