From patchwork Mon Jul 31 10:21:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 795677 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 3xLbD65Xt9z9rxm for ; Mon, 31 Jul 2017 20:24:38 +1000 (AEST) Received: from localhost ([::1]:58560 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dc7sK-00060A-Lj for incoming@patchwork.ozlabs.org; Mon, 31 Jul 2017 06:24:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50908) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dc7pd-00046v-W3 for qemu-devel@nongnu.org; Mon, 31 Jul 2017 06:21:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dc7pa-00068n-Tq for qemu-devel@nongnu.org; Mon, 31 Jul 2017 06:21:49 -0400 Received: from isrv.corpit.ru ([86.62.121.231]:48177) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dc7pa-00068O-LJ; Mon, 31 Jul 2017 06:21:46 -0400 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id E25CA42ABD; Mon, 31 Jul 2017 13:21:45 +0300 (MSK) Received: from tls.msk.ru (mjt.vpn.tls.msk.ru [192.168.177.99]) by tsrv.corpit.ru (Postfix) with SMTP id B7B6AB79; Mon, 31 Jul 2017 13:21:43 +0300 (MSK) Received: (nullmailer pid 5542 invoked by uid 1000); Mon, 31 Jul 2017 10:21:45 -0000 From: Michael Tokarev To: qemu-devel@nongnu.org Date: Mon, 31 Jul 2017 13:21:21 +0300 Message-Id: <36bed541ca886da735bef1e8d76d09f8849ed5dd.1501496349.git.mjt@msgid.tls.msk.ru> X-Mailer: git-send-email 2.11.0 In-Reply-To: References: In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 86.62.121.231 Subject: [Qemu-devel] [PULL 02/25] fix qemu-system-unicore32 crashing when calling without -kernel 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: Eduardo Otubo , qemu-trivial@nongnu.org, Michael Tokarev Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Eduardo Otubo Starting qemu-system-unicore32 without the -kernel parameter results in an assert() returns false and aborts qemu. This patch replaces it with a proper error message followed by exit(1). Signed-off-by: Eduardo Otubo Tested-by: Thomas Huth Signed-off-by: Michael Tokarev --- hw/unicore32/puv3.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hw/unicore32/puv3.c b/hw/unicore32/puv3.c index e9d1a60b6f..ff62efb4df 100644 --- a/hw/unicore32/puv3.c +++ b/hw/unicore32/puv3.c @@ -92,7 +92,10 @@ static void puv3_load_kernel(const char *kernel_filename) if (kernel_filename == NULL && qtest_enabled()) { return; } - assert(kernel_filename != NULL); + if (kernel_filename == NULL) { + error_report("kernel parameter cannot be empty"); + exit(1); + } /* only zImage format supported */ size = load_image_targphys(kernel_filename, KERNEL_LOAD_ADDR,