From patchwork Mon Aug 1 16:20:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Roger_Pau_Monn=C3=A9?= X-Patchwork-Id: 9254499 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8925E6048B for ; Mon, 1 Aug 2016 16:23:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7180328491 for ; Mon, 1 Aug 2016 16:23:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 64E2F284A7; Mon, 1 Aug 2016 16:23:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E29B328491 for ; Mon, 1 Aug 2016 16:23:44 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bUFxi-00027h-1l; Mon, 01 Aug 2016 16:21:06 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bUFxg-00027Z-TY for xen-devel@lists.xenproject.org; Mon, 01 Aug 2016 16:21:05 +0000 Received: from [85.158.137.68] by server-17.bemta-3.messagelabs.com id 20/A9-27186-FE67F975; Mon, 01 Aug 2016 16:21:03 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupnkeJIrShJLcpLzFFi42JxWrohUvd92fx wgwuTtSy+b5nM5MDocfjDFZYAxijWzLyk/IoE1owJnbdYCtZwVqztusLUwLiNvYuRk0NCwF9i +a0HrCA2m4COxMW5O9m6GDk4RARUJG7vNQAJMwuUSlzp/c0EEhYWcJI41MYCEmYBqnj+dRpYJ 6+Ai8THq5vYICbqSjw89xsqLihxcuYTFogxmhKt23+zQ9jyEs1bZzOD2EICihL98x5A9XJL3D 49lXkCI+8sJO2zkLTPQtK+gJF5FaNGcWpRWWqRrqGFXlJRZnpGSW5iZo6uoYGxXm5qcXFiemp OYlKxXnJ+7iZGYEDVMzAw7mD8fdrzEKMkB5OSKG9CwfxwIb6k/JTKjMTijPii0pzU4kOMMhwc ShK8gaVAOcGi1PTUirTMHGBow6QlOHiURHjZQdK8xQWJucWZ6RCpU4yKUuK83iAJAZBERmkeX Bssni4xykoJ8zIyMDAI8RSkFuVmlqDKv2IU52BUEuYtBZnCk5lXAjf9FdBiJqDFifZzQBaXJC KkpBoY55+NWhfXOFkrn32d18EIg9rXW0ou7Dyg/712lonRvRW/WHqOeecX3a5umPW2TzLn2fm uPBXBSfEhzAu7Z22bl3TQ8/s+EaWr+41qItcE3BVoP3Wt+RnDT8uan3oL00unxM9R38X71Slg xR7Nbcqv2xetOfKA8eLzrMMPRNrF9m5XNr3eVCNfqsRSnJFoqMVcVJwIAHeqvqqiAgAA X-Env-Sender: prvs=014994560=roger.pau@citrix.com X-Msg-Ref: server-9.tower-31.messagelabs.com!1470068461!7101601!1 X-Originating-IP: [66.165.176.89] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni44OSA9PiAyMDMwMDc=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 8.77; banners=-,-,- X-VirusChecked: Checked Received: (qmail 5843 invoked from network); 1 Aug 2016 16:21:03 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-9.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 1 Aug 2016 16:21:03 -0000 X-IronPort-AV: E=Sophos;i="5.28,456,1464652800"; d="scan'208";a="369609868" From: Roger Pau Monne To: Date: Mon, 1 Aug 2016 18:20:56 +0200 Message-ID: <1470068456-15064-1-git-send-email-roger.pau@citrix.com> X-Mailer: git-send-email 2.7.4 (Apple Git-66) MIME-Version: 1.0 X-DLP: MIA2 Cc: Ian Jackson , Wei Liu , Roger Pau Monne Subject: [Xen-devel] [PATCH] libxl: fix printing hotplug arguments/environment X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP A OS could decide to not pass arguments or any environment variables to hotplug scripts, and this will trigger a bug in device_hotplug logic, since it expects both the argument and the environment arrays to exist. Allow both args or env to be NULL. Signed-off-by: Roger Pau Monné --- Cc: Wei Liu Cc: Ian Jackson --- tools/libxl/libxl_device.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/libxl/libxl_device.c b/tools/libxl/libxl_device.c index b9a6df2..0e5f546 100644 --- a/tools/libxl/libxl_device.c +++ b/tools/libxl/libxl_device.c @@ -1132,7 +1132,7 @@ static void device_hotplug(libxl__egc *egc, libxl__ao_device *aodev) LOG(DEBUG, "calling hotplug script: %s %s", args[0], args[1]); LOG(DEBUG, "extra args:"); - { + if ( args != NULL) { const char *arg; unsigned int x; @@ -1140,7 +1140,7 @@ static void device_hotplug(libxl__egc *egc, libxl__ao_device *aodev) LOG(DEBUG, "\t%s", arg); } LOG(DEBUG, "env:"); - { + if ( env != NULL) { const char *k, *v; unsigned int x;