From patchwork Fri Oct 13 11:19:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Liu X-Patchwork-Id: 10004271 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 B131460216 for ; Fri, 13 Oct 2017 11:21:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A468729023 for ; Fri, 13 Oct 2017 11:21:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9816029030; Fri, 13 Oct 2017 11:21:53 +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 3AE9A29023 for ; Fri, 13 Oct 2017 11:21:52 +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 1e2y0J-0005U9-I5; Fri, 13 Oct 2017 11:19:47 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e2y0I-0005U2-Q5 for xen-devel@lists.xenproject.org; Fri, 13 Oct 2017 11:19:46 +0000 Received: from [85.158.143.35] by server-1.bemta-6.messagelabs.com id 11/A0-31121-251A0E95; Fri, 13 Oct 2017 11:19:46 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrHLMWRWlGSWpSXmKPExsXitHRDpK7fwge RBv/O6Vh83zKZyYHR4/CHKywBjFGsmXlJ+RUJrBm9S64xFuxmrej9sJ+tgXErSxcjJ4eEgL/E jDfP2EFsNgFliZ+dvWwgtoiAnkTTgeeMIDazQIHEhW8dYDXCAu4SKzZ/Berl4GARUJXYdNEPJ MwrYC4x48xBNoiR8hK72i6ygthCAgoSHdOPMUHUCEqcnPmEBWKkhMTBFy+YJzByz0KSmoUktY CRaRWjRnFqUVlqka6hoV5SUWZ6RkluYmaOrqGBmV5uanFxYnpqTmJSsV5yfu4mRmAoMADBDsZ PywIOMUpyMCmJ8qpFPogU4kvKT6nMSCzOiC8qzUktPsQow8GhJMGbvAAoJ1iUmp5akZaZAwxK mLQEB4+SCG8USJq3uCAxtzgzHSJ1itGY48bD63+YODpu3v3DJMSSl5+XKiXO2wNSKgBSmlGaB zcIFi2XGGWlhHkZgU4T4ilILcrNLEGVf8UozsGoJMz7dT7QFJ7MvBK4fa+ATmECOuVdBNgpJY kIKakGRvUZL9TmRC3wcNVYc6jp2N6DJ97x+QV4f1ac0lX7q+71XMZroo0yKn0SHbrLTk+5a3J wnoPIyxNCF+oUgr4ufH78bI3kl/JHM0o6nrNs/fL18Bxh17KkaGu3V1v5tI8LHMxQUthsmRK8 Vcgl4mvB8udCT2TmzIw4qLAh2bojUuTfcuMOR5lN9UosxRmJhlrMRcWJADpDIXyRAgAA X-Env-Sender: prvs=452bf3591=wei.liu2@citrix.com X-Msg-Ref: server-13.tower-21.messagelabs.com!1507893581!71164032!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: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 40729 invoked from network); 13 Oct 2017 11:19:42 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-13.tower-21.messagelabs.com with RC4-SHA encrypted SMTP; 13 Oct 2017 11:19:42 -0000 X-IronPort-AV: E=Sophos;i="5.43,370,1503360000"; d="scan'208";a="445885520" From: Wei Liu To: Xen-devel Date: Fri, 13 Oct 2017 12:19:38 +0100 Message-ID: <20171013111938.2749-1-wei.liu2@citrix.com> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 Cc: Ian Jackson , Julien Grall , Wei Liu Subject: [Xen-devel] [PATCH for-4.10] libxl: handle NULL in libxl__enum_from_string 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 Discovered by Coverity. Signed-off-by: Wei Liu --- Cc: Ian Jackson --- tools/libxl/libxl_utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/libxl/libxl_utils.c b/tools/libxl/libxl_utils.c index 507ee56c7c..9433693e72 100644 --- a/tools/libxl/libxl_utils.c +++ b/tools/libxl/libxl_utils.c @@ -1017,7 +1017,7 @@ int libxl_get_max_nodes(libxl_ctx *ctx) int libxl__enum_from_string(const libxl_enum_string_table *t, const char *s, int *e) { - if (!t) return ERROR_INVAL; + if (!t || !s) return ERROR_INVAL; for( ; t->s; t++) { if (!strcasecmp(t->s, s)) {