From patchwork Wed May 25 13:23:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Liu X-Patchwork-Id: 9135347 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 2A77B607D7 for ; Wed, 25 May 2016 13:26:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1DB6227D10 for ; Wed, 25 May 2016 13:26:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1267728253; Wed, 25 May 2016 13:26:28 +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 0FF6D27D10 for ; Wed, 25 May 2016 13:26:27 +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 1b5Yn6-0001ZL-1x; Wed, 25 May 2016 13:24:04 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b5Yn4-0001ZF-OF for xen-devel@lists.xenproject.org; Wed, 25 May 2016 13:24:02 +0000 Received: from [85.158.139.211] by server-13.bemta-5.messagelabs.com id A6/D4-15225-F67A5475; Wed, 25 May 2016 13:23:59 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmplkeJIrShJLcpLzFFi42JxWrohUjd/uWu 4QftETovvWyYzOTB6HP5whSWAMYo1My8pvyKBNePy5X8sBXPZKjq/vGVqYJzJ2sXIySEh4C/x YNdBdhCbTUBZ4mdnLxuILSKgJ9F04DkjiM0s4CXxYt0/MFtYwEpixfIGsF4WAVWJXd8ug/XyC jhLTJq0lxlippzE+eM/wWwhAQWJjunHmCBqBCVOznzCAjFTQuLgixdQ9dwSt09PZZ7AyDMLSd ksJGULGJlWMWoUpxaVpRbpGlroJRVlpmeU5CZm5ugaGpjq5aYWFyemp+YkJhXrJefnbmIEBgk DEOxgbNrueYhRkoNJSZSXfbFruBBfUn5KZUZicUZ8UWlOavEhRhkODiUJXv9lQDnBotT01Iq0 zBxguMKkJTh4lER4ry8FSvMWFyTmFmemQ6ROMepyLPhxey2TEEtefl6qlDivB8gMAZCijNI8u BGw2LnEKCslzMsIdJQQT0FqUW5mCar8K0ZxDkYlYd5NIFN4MvNK4Da9AjqCCegI/y/OIEeUJC KkpBoY26//PZFTukLUPdf9+8JzepWa8fzlPrrfH0+fM8t2Qv+xGWt5xAP4teWcry9ZnMlsc/x Mr/KPRwc+KJQLXEnbs9my7Zr3w1fHFxT/Vi5TLn7nvPTZ+ZBfjFf645uuLp5kta5WjLVyv9jK B2+mJr/e5+BzLSH0lJZH0vTzCw+H7Np49Fe2vMaR+UosxRmJhlrMRcWJAO3bYiqYAgAA X-Env-Sender: prvs=94638e76f=wei.liu2@citrix.com X-Msg-Ref: server-4.tower-206.messagelabs.com!1464182637!41570552!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.34; banners=-,-,- X-VirusChecked: Checked Received: (qmail 29286 invoked from network); 25 May 2016 13:23:58 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-4.tower-206.messagelabs.com with RC4-SHA encrypted SMTP; 25 May 2016 13:23:58 -0000 X-IronPort-AV: E=Sophos;i="5.26,364,1459814400"; d="scan'208";a="356549831" From: Wei Liu To: Xen-devel Date: Wed, 25 May 2016 14:23:56 +0100 Message-ID: <1464182636-26113-1-git-send-email-wei.liu2@citrix.com> X-Mailer: git-send-email 2.1.4 MIME-Version: 1.0 X-DLP: MIA2 Cc: Ian Jackson , Wei Liu Subject: [Xen-devel] [PATCH for-4.7] xl: use xstrdup in cpurange_parse 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 This ensures buf is always valid when it is passed to strtok_r. CID: 1291936 Signed-off-by: Wei Liu Reviewed-by: Andrew Cooper Acked-by: Ian Jackson --- Cc: Ian Jackson This is a backport candidate. --- tools/libxl/xl_cmdimpl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c index 03ab644..d8530f0 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -847,7 +847,7 @@ static int update_cpumap_range(const char *str, libxl_bitmap *cpumap) */ static int cpurange_parse(const char *cpu, libxl_bitmap *cpumap) { - char *ptr, *saveptr = NULL, *buf = strdup(cpu); + char *ptr, *saveptr = NULL, *buf = xstrdup(cpu); int rc = 0; for (ptr = strtok_r(buf, ",", &saveptr); ptr;