From patchwork Tue Aug 2 10:49:51 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: 9255459 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 F0A8760754 for ; Tue, 2 Aug 2016 10:52:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D7F3828506 for ; Tue, 2 Aug 2016 10:52:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CD07328514; Tue, 2 Aug 2016 10:52: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 254A928506 for ; Tue, 2 Aug 2016 10:52: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 1bUXGq-00053I-JL; Tue, 02 Aug 2016 10:50:00 +0000 Received: from mail6.bemta6.messagelabs.com ([85.158.143.247]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bUXGp-00053C-Mx for xen-devel@lists.xenproject.org; Tue, 02 Aug 2016 10:49:59 +0000 Received: from [85.158.143.35] by server-3.bemta-6.messagelabs.com id 28/DC-05661-7DA70A75; Tue, 02 Aug 2016 10:49:59 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupnkeJIrShJLcpLzFFi42JxWrrBXvda1YJ wg6eX1S2+b5nM5MDocfjDFZYAxijWzLyk/IoE1oxPX6cyF6zkrJj85yxLA+N29i5GTg4JAX+J q8u/gtlsAjoSF+fuZOti5OAQEVCRuL3XACTMLFAqcaX3NxOILSzgKrGpZw8ziM0CVHJv/Uowm 1fARWL254csECN1JR6e+80KEReUODnzCQvEHE2J1u2/2SFseYnmrbPBeoUEFCX65z1gg+jllr h9eirzBEbeWUjaZyFpn4WkfQEj8ypG9eLUorLUIl0LvaSizPSMktzEzBxdQwMzvdzU4uLE9NS cxKRiveT83E2MwIBiAIIdjLMv+x9ilORgUhLldfkyP1yILyk/pTIjsTgjvqg0J7X4EKMMB4eS BK8EMECFBItS01Mr0jJzgKENk5bg4FES4T1QCZTmLS5IzC3OTIdInWJUlBLnfQKSEABJZJTmw bXB4ukSo6yUMC8j0CFCPAWpRbmZJajyrxjFORiVhCG282TmlcBNfwW0mAlo8QkDsMUliQgpqQ bGAyeVRBnvytXpOdV/92lsevz5e9fJOWUnAj/+YbKWn69ovmT+ActuryVT1Bnu/Vgv85pFKW5 FrkaG8dOzphsLuruMN8rskO9PUtrp3Mt9O3Havvdc3CsanjE/5PSoLhR2VEzLfHBvuv4H5ftx S6991ZCdcpnxebXHSUmul6HG/jlvfnK/eXhEiaU4I9FQi7moOBEAvmO0pKICAAA= X-Env-Sender: prvs=015484912=roger.pau@citrix.com X-Msg-Ref: server-12.tower-21.messagelabs.com!1470134996!26825240!1 X-Originating-IP: [66.165.176.63] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni42MyA9PiAzMDYwNDg=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 8.77; banners=-,-,- X-VirusChecked: Checked Received: (qmail 49172 invoked from network); 2 Aug 2016 10:49:58 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-12.tower-21.messagelabs.com with RC4-SHA encrypted SMTP; 2 Aug 2016 10:49:58 -0000 X-IronPort-AV: E=Sophos;i="5.28,459,1464652800"; d="scan'208";a="376858370" From: Roger Pau Monne To: Date: Tue, 2 Aug 2016 12:49:51 +0200 Message-ID: <1470134991-17569-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 v2] 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 An OS could decide to not pass any environment variables to hotplug scripts, and this will trigger a bug in device_hotplug logic, since it expects the environment array to exist. Allow env to be NULL. Signed-off-by: Roger Pau Monné Acked-by: Wei Liu --- Cc: Wei Liu Cc: Ian Jackson --- Changes since v1: - Fix commit message - Only allow env to be NULL. --- tools/libxl/libxl_device.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/libxl/libxl_device.c b/tools/libxl/libxl_device.c index b9a6df2..dbf157d 100644 --- a/tools/libxl/libxl_device.c +++ b/tools/libxl/libxl_device.c @@ -1130,6 +1130,7 @@ static void device_hotplug(libxl__egc *egc, libxl__ao_device *aodev) goto out; } + assert(args != NULL); LOG(DEBUG, "calling hotplug script: %s %s", args[0], args[1]); LOG(DEBUG, "extra args:"); { @@ -1140,7 +1141,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;