From patchwork Thu Apr 7 09:40:26 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunyan Liu X-Patchwork-Id: 8770211 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 1BA6A9FBEA for ; Thu, 7 Apr 2016 09:43:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 44D0B2011E for ; Thu, 7 Apr 2016 09:43:53 +0000 (UTC) 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.kernel.org (Postfix) with ESMTPS id 0B37B200E8 for ; Thu, 7 Apr 2016 09:43: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 1ao6R5-0005dI-6o; Thu, 07 Apr 2016 09:41:11 +0000 Received: from mail6.bemta6.messagelabs.com ([85.158.143.247]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ao6R3-0005aa-FN for xen-devel@lists.xen.org; Thu, 07 Apr 2016 09:41:09 +0000 Received: from [85.158.143.35] by server-3.bemta-6.messagelabs.com id 47/01-07120-43B26075; Thu, 07 Apr 2016 09:41:08 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrFLMWRWlGSWpSXmKPExsXS6fhLStdEmy3 c4N5aOYslHxezODB6HN39mymAMYo1My8pvyKBNWPnknvMBZM5K/a3rGVuYFzD3sXIxSEksJZR YvGeK8xdjJwcbAJKEm9/rWYHsUUEpCWufb7MCFLELDCDUeLL6w1MIAlhAXOJrz2rwGwWAVWJL V3TwWxeATuJcx39YIMkBOQkzh//CWZzCthLrJ/5hAXEFgKqaWiYzjiBkWsBI8MqRvXi1KKy1C JdQ72kosz0jJLcxMwcXUMDM73c1OLixPTUnMSkYr3k/NxNjEA/MgDBDsadz50OMUpyMCmJ8p6 VYgsX4kvKT6nMSCzOiC8qzUktPsQow8GhJMGrqQWUEyxKTU+tSMvMAQYUTFqCg0dJhHeLJlCa t7ggMbc4Mx0idYpRUUqcVw6kTwAkkVGaB9cGC+JLjLJSwryMQIcI8RSkFuVmlqDKv2IU52BUE uZlB5nCk5lXAjf9FdBiJqDFF/jBFpckIqSkGhgzpr+b+uH98ciNmbJrGXYcyfkj7pi+8f4m1j URIl+mJ8Rv+mCjVcvx7ovlzBl6NhEBWx33vpN8N++N+qXnd0U1nqSx302wfSGsxu92Z2vshpT 3PMuDTS9Vmmj+OytS//GI8qJKL8eKJ8dmO83KyD9mUZt5oXeq9UnvPW1WzOyHWvdJzT7B7L5W iaU4I9FQi7moOBEAluWU/F0CAAA= X-Env-Sender: cyliu@suse.com X-Msg-Ref: server-9.tower-21.messagelabs.com!1460022064!7964056!1 X-Originating-IP: [137.65.250.26] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.28; banners=-,-,- X-VirusChecked: Checked Received: (qmail 6449 invoked from network); 7 Apr 2016 09:41:08 -0000 Received: from victor.provo.novell.com (HELO prv3-mh.provo.novell.com) (137.65.250.26) by server-9.tower-21.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 7 Apr 2016 09:41:08 -0000 Received: from linux-3hvf.site (prv-ext-foundry1int.gns.novell.com [137.65.251.240]) by prv3-mh.provo.novell.com with ESMTP (TLS encrypted); Thu, 07 Apr 2016 03:40:50 -0600 From: Chunyan Liu To: xen-devel@lists.xen.org Date: Thu, 7 Apr 2016 17:40:26 +0800 Message-Id: <1460022028-25174-3-git-send-email-cyliu@suse.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1460022028-25174-1-git-send-email-cyliu@suse.com> References: <1460022028-25174-1-git-send-email-cyliu@suse.com> Cc: Simon Cao , Ian Jackson , Chunyan Liu , George Dunlap Subject: [Xen-devel] [PATCH 2/4] correct libxl_write_exactly sizeof 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: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP sizeof is wrongly used in libxl_write_exactly function, using strlen instead. CID: 1358110 CID: 1358109 Signed-off-by: Chunyan Liu CC: Simon Cao CC: George Dunlap CC: Ian Jackson Acked-by: Ian Jackson --- tools/libxl/libxl_pvusb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/libxl/libxl_pvusb.c b/tools/libxl/libxl_pvusb.c index 04e41b4..45117cf 100644 --- a/tools/libxl/libxl_pvusb.c +++ b/tools/libxl/libxl_pvusb.c @@ -1025,7 +1025,7 @@ static int unbind_usbintf(libxl__gc *gc, const char *intf) goto out; } - if (libxl_write_exactly(CTX, fd, intf, sizeof(intf), path, intf)) { + if (libxl_write_exactly(CTX, fd, intf, strlen(intf), path, intf)) { rc = ERROR_FAIL; goto out; } @@ -1065,7 +1065,7 @@ static int bind_usbintf(libxl__gc *gc, const char *intf, const char *drvpath) goto out; } - if (libxl_write_exactly(CTX, fd, intf, sizeof(intf), path, intf)) { + if (libxl_write_exactly(CTX, fd, intf, strlen(intf), path, intf)) { rc = ERROR_FAIL; goto out; }