Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp5497785ybe; Tue, 10 Sep 2019 04:47:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqxa9aicL5jeF/SO9Ntieiwymi/20u1yhWLpPekzT9+H/tb6NxGvkR/P91GF+Zh/ScBX3X5S X-Received: by 2002:a50:b582:: with SMTP id a2mr14551126ede.98.1568116071441; Tue, 10 Sep 2019 04:47:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568116071; cv=none; d=google.com; s=arc-20160816; b=JYhepX7tYzJFIPwL3Xu1ZcOIjm+ThTC5f4QZJejT9I3v/dUEvHWOinmhqCroGWPdjX gWv2IMU4//BMQCmwjcgVXwNHRX5ibSsuPKP6M0VfXQ8hj7KCTUaXlhvaSjEjgugqfNre 1ObzD3kw1BcsUIZYlGbOesUx9TBf1s/82k6IJbWUOaW3KPUj296V87KU2bdG8MQ7dOdz IPSRC8w6XbvergmXt4WqYWt7D+iTaWpa/jqf4p6q32SWrw7HLKg8sn/nyPKb5DEkhzVR /lFraxpTQb16dc2bhs0BxwTYWqZWBi/1WzJLDXKghB14xrzEDAJTUlA/fYylSgm6Kw+Q Rcow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=Ct3xa266wyxHJytYg3Jqc6Uz5k20Q/FthlP3nJHhVjs=; b=lmZjvuq1ZHQ72w/Yz2VRi0paopKwq5SwGU5AeoeSU6mG6wCZc6ioTQVzwlbQ7D8VEy voGaY0TrRmmBF1iJgpm8PnZh5y+AHZk8MqgC+rXO0HGdoHZUZ8EJ5EWUb4BRj/2t5QMZ Xta/JscYTpSKOsKw8HK6qALCQArlnhm2VM0BvtcabBPgPNt1xF9PoqNDge2Ps2HOnQNK Uq+Jiy4xjWiv8byn2Lf+OY1JMAk+PqlxuhRQVXuFNXwPbln9YukaQ02D2lFUSQZcGmBY THbe15gCHaIbxC66cCTodQazZnVmvwoCMVsScCHs9l8a8zSb9Msp9BcwJZ9GN7lIH9/9 DLvQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id fy13si9013043ejb.50.2019.09.10.04.47.27; Tue, 10 Sep 2019 04:47:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2406803AbfIJIUP (ORCPT + 99 others); Tue, 10 Sep 2019 04:20:15 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33244 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406759AbfIJIUL (ORCPT ); Tue, 10 Sep 2019 04:20:11 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5ED43800DEB; Tue, 10 Sep 2019 08:20:11 +0000 (UTC) Received: from jason-ThinkPad-X1-Carbon-6th.redhat.com (ovpn-12-188.pek2.redhat.com [10.72.12.188]) by smtp.corp.redhat.com (Postfix) with ESMTP id D0E7360623; Tue, 10 Sep 2019 08:20:03 +0000 (UTC) From: Jason Wang To: mst@redhat.com, jasowang@redhat.com, kvm@vger.kernel.org, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kwankhede@nvidia.com, alex.williamson@redhat.com, cohuck@redhat.com, tiwei.bie@intel.com, maxime.coquelin@redhat.com, cunming.liang@intel.com, zhihong.wang@intel.com, rob.miller@broadcom.com, idos@mellanox.com, xiao.w.wang@intel.com, haotian.wang@sifive.com Subject: [RFC PATCH 1/4] vringh: fix copy direction of vringh_iov_push_kern() Date: Tue, 10 Sep 2019 16:19:32 +0800 Message-Id: <20190910081935.30516-2-jasowang@redhat.com> In-Reply-To: <20190910081935.30516-1-jasowang@redhat.com> References: <20190910081935.30516-1-jasowang@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.67]); Tue, 10 Sep 2019 08:20:11 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We want to copy from iov to buf, so the direction was wrong. Signed-off-by: Jason Wang --- drivers/vhost/vringh.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/vhost/vringh.c b/drivers/vhost/vringh.c index 08ad0d1f0476..a0a2d74967ef 100644 --- a/drivers/vhost/vringh.c +++ b/drivers/vhost/vringh.c @@ -852,6 +852,12 @@ static inline int xfer_kern(void *src, void *dst, size_t len) return 0; } +static inline int kern_xfer(void *dst, void *src, size_t len) +{ + memcpy(dst, src, len); + return 0; +} + /** * vringh_init_kern - initialize a vringh for a kernelspace vring. * @vrh: the vringh to initialize. @@ -958,7 +964,7 @@ EXPORT_SYMBOL(vringh_iov_pull_kern); ssize_t vringh_iov_push_kern(struct vringh_kiov *wiov, const void *src, size_t len) { - return vringh_iov_xfer(wiov, (void *)src, len, xfer_kern); + return vringh_iov_xfer(wiov, (void *)src, len, kern_xfer); } EXPORT_SYMBOL(vringh_iov_push_kern); -- 2.19.1