From patchwork Sat Feb 16 09:03:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lijun Ou X-Patchwork-Id: 10816145 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B5F8C13B5 for ; Sat, 16 Feb 2019 09:03:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A60B32D58F for ; Sat, 16 Feb 2019 09:03:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9A5A52D60F; Sat, 16 Feb 2019 09:03:24 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 55A822D58F for ; Sat, 16 Feb 2019 09:03:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731567AbfBPJDX (ORCPT ); Sat, 16 Feb 2019 04:03:23 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:3745 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729565AbfBPJDX (ORCPT ); Sat, 16 Feb 2019 04:03:23 -0500 Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 3888BD46AA7F23F4F2EE; Sat, 16 Feb 2019 17:03:18 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS404-HUB.china.huawei.com (10.3.19.204) with Microsoft SMTP Server id 14.3.408.0; Sat, 16 Feb 2019 17:03:11 +0800 From: Lijun Ou To: , CC: , , Subject: [PATCH rdma-core 5/5] libhns: Bugfix for useing buffer length Date: Sat, 16 Feb 2019 17:03:33 +0800 Message-ID: <1550307813-151285-6-git-send-email-oulijun@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1550307813-151285-1-git-send-email-oulijun@huawei.com> References: <1550307813-151285-1-git-send-email-oulijun@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We should use the length of buffer after aligned according the input size for ibv_dontfork_range function. Fix: c24583975044("libhns: Add verbs of qp support") Signed-off-by: Lijun Ou --- providers/hns/hns_roce_u_buf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/providers/hns/hns_roce_u_buf.c b/providers/hns/hns_roce_u_buf.c index f92ea65..27ed90c 100644 --- a/providers/hns/hns_roce_u_buf.c +++ b/providers/hns/hns_roce_u_buf.c @@ -46,7 +46,7 @@ int hns_roce_alloc_buf(struct hns_roce_buf *buf, unsigned int size, if (buf->buf == MAP_FAILED) return errno; - ret = ibv_dontfork_range(buf->buf, size); + ret = ibv_dontfork_range(buf->buf, buf->length); if (ret) munmap(buf->buf, buf->length);