Received: by 10.223.185.116 with SMTP id b49csp5962229wrg; Wed, 7 Mar 2018 22:44:40 -0800 (PST) X-Google-Smtp-Source: AG47ELsHdUapFh7C1IPoeoNGkoQ+CNeBGL9rNrb6AovwIt4/T4rQSEJOhUoNpbkNfKpgVys9hAtg X-Received: by 10.99.5.197 with SMTP id 188mr20232564pgf.196.1520491480076; Wed, 07 Mar 2018 22:44:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520491480; cv=none; d=google.com; s=arc-20160816; b=zbQHMku3UB2kRks069z9nhd0uRhgYcXGAcHl7J/b3UB3PMgAEKvPb6hK8Yq3BXOYz1 sxDYf1T4SaNQgkoQh5tiUIwDk6AtjlnMFdh66brQJz+nD8/1AVbmIpN1n/MPN3wGk5WF H3UYR4nKCJZ9upA+4L9pNBtH2Wy7nwNElfbTtszvEC5Y/B9lM1/r2RQ9eXvfegNjcde/ T7bphCgfSYp+paYM1dscBm7bfDABbs8yMRfZuswZzn7FjaZ1Wfjg28XtOsNMbFyp94dz LtU9SDam3Z9K13VLxoyMuR0M+zPg/dn8R4dWaC64ZPOxNvZDf6YoZp3GbjHDzV2tbe9c uXYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=k+tpxEess4MEsDM/AnJCvtOBGHZPFxl6fG0VhO22o+w=; b=OgiAdYHXxs+Ul4b8If9eDGiEUhcpXauzfdX8XiVO5FA4YQYJk2mLRq9EJGVeAvqolr 4XrfPNKWgh4eyg7+IoJy6qx0t6QeHVzBPCXxshb030lTcIWxA0gD/Q02e3Yf5stwbV6n CybNjp6fX/40N7o5X1Zkc9gv2k3X07ytWkr+ur1GM/FEm1eYylHQdTKSxeiI7OpAYgqW QpYAY1onV4B9wiWzRo7dFOMBbx5wXWl11QdkrYzEsRsJgQg8v4Wua3KrMbftNLKIy6Qc 8lnFfwV5VUmEOmJ02hZcPwlyWWdAxD2t5zfU0wwRSrB+6i97OmpGqfmhlQ1XWEkoTI33 NhfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=o1Y5pOqz; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u91-v6si11226072plb.341.2018.03.07.22.44.25; Wed, 07 Mar 2018 22:44:40 -0800 (PST) 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; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=o1Y5pOqz; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965516AbeCHGmb (ORCPT + 99 others); Thu, 8 Mar 2018 01:42:31 -0500 Received: from mail-by2nam03on0124.outbound.protection.outlook.com ([104.47.42.124]:6433 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S965242AbeCHE7A (ORCPT ); Wed, 7 Mar 2018 23:59:00 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=k+tpxEess4MEsDM/AnJCvtOBGHZPFxl6fG0VhO22o+w=; b=o1Y5pOqzR55fKZjdoLyRn7CdlScIENG1V9tAQOdX7Dc5HYtNKk2RDqsftAYBCcfnbPbDEqRHDDmyUByD5Ev3AWc+adAW1tqRaHB07Y1YwQ08p6sFAq+PdwDlOvw4yveoj81u/3wXledC6E275VjOqP0zS/dAMFnEq5dtgKVvVnM= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB1080.namprd21.prod.outlook.com (52.132.130.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.588.3; Thu, 8 Mar 2018 04:58:56 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8063:c68a:b210:7446]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8063:c68a:b210:7446%2]) with mapi id 15.20.0588.008; Thu, 8 Mar 2018 04:58:56 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Artemy Kovalyov , Leon Romanovsky , Jason Gunthorpe , Sasha Levin Subject: [PATCH AUTOSEL for 4.14 38/67] IB/umem: Fix use of npages/nmap fields Thread-Topic: [PATCH AUTOSEL for 4.14 38/67] IB/umem: Fix use of npages/nmap fields Thread-Index: AQHTtpoApTRTZR5WLEKU14Ycjc5gBw== Date: Thu, 8 Mar 2018 04:57:48 +0000 Message-ID: <20180308045641.7814-38-alexander.levin@microsoft.com> References: <20180308045641.7814-1-alexander.levin@microsoft.com> In-Reply-To: <20180308045641.7814-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DM5PR2101MB1080;20:l5WNz+edoYQEctK7ZLh5Zk3lc8ChAWSKCDJ1X1yCjxG3yfjbLrP+dyyzjJ690oTds+ltazcCwNIXM1LkiEtOehf20jON2UIaaOshzKvh44AWeT3Z6UAA6GbOEjFq+zcNiqAxQYbeJE/tGOTc4OtK2C9bTfd3VP5nI8hVsscz3Fc= x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 8e8b2c92-fd7e-4afb-68fb-08d584b14c4a x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB1080; x-ms-traffictypediagnostic: DM5PR2101MB1080: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040501)(2401047)(8121501046)(5005006)(3231220)(944501244)(52105095)(93006095)(93001095)(10201501046)(3002001)(6055026)(61426038)(61427038)(6041288)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(20161123560045)(6072148)(201708071742011);SRVR:DM5PR2101MB1080;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB1080; x-forefront-prvs: 060503E79B x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(396003)(376002)(366004)(39380400002)(346002)(39860400002)(189003)(199004)(6116002)(1076002)(5250100002)(26005)(102836004)(2501003)(3846002)(59450400001)(186003)(6506007)(25786009)(3280700002)(4326008)(2906002)(68736007)(66066001)(86612001)(3660700001)(22452003)(6486002)(6436002)(14454004)(8676002)(81166006)(2900100001)(72206003)(81156014)(8936002)(478600001)(10090500001)(105586002)(10290500003)(53936002)(6512007)(6666003)(107886003)(2950100002)(106356001)(76176011)(316002)(7736002)(86362001)(36756003)(97736004)(54906003)(110136005)(5660300001)(99286004)(305945005)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB1080;H:DM5PR2101MB1032.namprd21.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: Cb2B86BrQysusDI2HHFkF9SXGTL/u9L+xjGkbyTI75Oo2WqOGNg4go3f1LZOXUb4WVq6SJo4ae7S2AwUA9TdbKnetG85qwZrFyZRfLNrPoBaI7vDk3Qj45mKMj2k9qRUEMh7CaREfwdt79ikN1Hh+eYj3CZIC5AeqKued3XTZ9dn51agw83Sh2k0JjpTr4bmkCyiOs/xvg1Rs9b4muWj+1Z8CbEIn262dQ4ZMQkzzQz4MuTsVA3clkbVVCCNSBnpI8lORDgMM+ZJw/lBrG0cOnXmvHts5EMrxjoJa12fS3bnweN9UUm9u1xtVgKpetNWZXQs7DEnldlWUJI3voi3FQ== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8e8b2c92-fd7e-4afb-68fb-08d584b14c4a X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Mar 2018 04:57:48.1944 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB1080 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Artemy Kovalyov [ Upstream commit edf1a84fe37c51290e2c88154ecaf48dadff3d27 ] In ib_umem structure npages holds original number of sg entries, while nmap is number of DMA blocks returned by dma_map_sg. Fixes: c5d76f130b28 ('IB/core: Add umem function to read data from user-spa= ce') Signed-off-by: Artemy Kovalyov Signed-off-by: Leon Romanovsky Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin --- drivers/infiniband/core/umem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/infiniband/core/umem.c b/drivers/infiniband/core/umem.= c index 130606c3b07c..9a4e899d94b3 100644 --- a/drivers/infiniband/core/umem.c +++ b/drivers/infiniband/core/umem.c @@ -352,7 +352,7 @@ int ib_umem_copy_from(void *dst, struct ib_umem *umem, = size_t offset, return -EINVAL; } =20 - ret =3D sg_pcopy_to_buffer(umem->sg_head.sgl, umem->nmap, dst, length, + ret =3D sg_pcopy_to_buffer(umem->sg_head.sgl, umem->npages, dst, length, offset + ib_umem_offset(umem)); =20 if (ret < 0) --=20 2.14.1