Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp767511ybl; Wed, 11 Dec 2019 07:13:53 -0800 (PST) X-Google-Smtp-Source: APXvYqwNEWlxgOGju0L89E1O3lHqrqVnz4EaFodneoeWmNTs706EfCcMExZtm9i1ih2sf0jT9hJH X-Received: by 2002:aca:bb08:: with SMTP id l8mr3028173oif.47.1576077233553; Wed, 11 Dec 2019 07:13:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576077233; cv=none; d=google.com; s=arc-20160816; b=rYqB8mQJUKCzZiEZHPI9fPO6+CN8ncPatWa3D7ov1tNtRVNvFZVau+hTvQgfbxvgYZ MWnpY7f3ZG+DWFkxcLZmL72taStNis72Knm1zVMDDg9VgoNO9udZBnI6g/2ktq03HxUz Bh4UaHTY2g7LEl/3SBaZbkm5tS0u+xDl6ysSAvs7VVyncgpBmL4zDStrZRMfOc1S2V9M Q8vDc71lzgHUERzRx4J/jE7GIBBPWzXaYd9OrnTwmS8dxnzRF+TS/+zvbZYjg9lPko9f F36BmBVdJFX1tLVo9jJT9l2ZpHweKTnnx1+pFGuuX4IgBxCovM987pNfrrcCy0clK6TJ pq8w== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=OHtl9YRbQoJnoIw0poYEo2TAbWJQSgFaVKVApN4ixKk=; b=lm9bAemwCvfLDpsNVGQg7+KmOXtvZnaQCVaJ6vf31IN+b5KBpWXbAQf8SdBFN0qbFi ECEzO2IFaBUBG8EeQeIo7dcIwzEk0IyUg9XYGac9G5uxZ8J2qXhNAEt5vvqOQ2pLwM+Z 8r3zP8Xhe5irNX3IWfAjHbnOia3m/8hKS8f0zF8tm0hJM4rqMBMNTVeYh8LrCG/T7Nhv XK0jHQRGXpWh7SLbD/QLEzOG1yy/mDJR22tffgQD6d3v8XeIMyH6J6UHo3AAE7U8k/JE K9vkHOmfOhfGyCv4tviSwQZICWwRZamXxEcaTFOiHAlgApo+GB0m/uy0V8sd+XXUgFrf SzAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=yZEKJZXf; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w4si1398014oia.56.2019.12.11.07.13.41; Wed, 11 Dec 2019 07:13:53 -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=@kernel.org header.s=default header.b=yZEKJZXf; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730625AbfLKPLq (ORCPT + 99 others); Wed, 11 Dec 2019 10:11:46 -0500 Received: from mail.kernel.org ([198.145.29.99]:60438 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730973AbfLKPLo (ORCPT ); Wed, 11 Dec 2019 10:11:44 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E06EC24656; Wed, 11 Dec 2019 15:11:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576077103; bh=Fhbul9K/HMLRSX3c55X5Ifo4uMXJN3nyNeySuYAWwxI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yZEKJZXftrDHcEcDUUeIE5OVD+dxS41OYH4z+AxaMnGDsX0rYpVP3GE6iu+KFX6JG mqVy3ZQw57ZLdZBT5fNflWhCmr/cb7+TJf5jX7ySizyR+K6R1tTIJRTFK0OJHVaeQS X01AaTdY37Th8j8fp/CKm2vDxYCp+UsmMV9NO3SE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wenpeng Liang , Weihang Li , Jason Gunthorpe , Sasha Levin Subject: [PATCH 5.3 018/105] RDMA/hns: Correct the value of srq_desc_size Date: Wed, 11 Dec 2019 16:05:07 +0100 Message-Id: <20191211150225.287486982@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191211150221.153659747@linuxfoundation.org> References: <20191211150221.153659747@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Wenpeng Liang [ Upstream commit 411c1e6774e2e1f96b1ccce4f119376b94ade3e4 ] srq_desc_size should be rounded up to pow of two before used, or related calculation may cause allocating wrong size of memory for srq buffer. Fixes: c7bcb13442e1 ("RDMA/hns: Add SRQ support for hip08 kernel mode") Link: https://lore.kernel.org/r/1572575610-52530-3-git-send-email-liweihang@hisilicon.com Signed-off-by: Wenpeng Liang Signed-off-by: Weihang Li Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin --- drivers/infiniband/hw/hns/hns_roce_srq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/hns/hns_roce_srq.c b/drivers/infiniband/hw/hns/hns_roce_srq.c index 38bb548eaa6d8..9768e377cd22c 100644 --- a/drivers/infiniband/hw/hns/hns_roce_srq.c +++ b/drivers/infiniband/hw/hns/hns_roce_srq.c @@ -221,7 +221,7 @@ int hns_roce_create_srq(struct ib_srq *ib_srq, srq->max = roundup_pow_of_two(srq_init_attr->attr.max_wr + 1); srq->max_gs = srq_init_attr->attr.max_sge; - srq_desc_size = max(16, 16 * srq->max_gs); + srq_desc_size = roundup_pow_of_two(max(16, 16 * srq->max_gs)); srq->wqe_shift = ilog2(srq_desc_size); -- 2.20.1