Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3716008imm; Mon, 18 Jun 2018 02:52:33 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJkPt3UywcAgRQ9XsfE9JnVdFJRGH+snVDYVX0qJQVPLD+Tk6HKhdcQE69tL7G5Br8gATXB X-Received: by 2002:aa7:85c9:: with SMTP id z9-v6mr12574488pfn.55.1529315553926; Mon, 18 Jun 2018 02:52:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529315553; cv=none; d=google.com; s=arc-20160816; b=epvQXTAT8sDGGwOIgkGxAirNeLRJ9VPSW3iQOZ2Xw5jKx0PtIdDgexOnQekO6yr2aB Tb0JOF5VDHWJf/6yCKjWh8y3We7PQkTfvlPTGcuC4h3abyz945PIhEWj/QOEHfqdGv1M DPtDzI70oM9zXeCWjpBcbTKp8X0L6r+fa2WLAlBCjZVxK/Y/kVDcfvMrl9ATIh38A3Jo 5xKG8bEBLrGV88mlhMs7LR9QhWoHIN45J9jre6REkIiK5wrRWX9FVB4MtoYHKF9RKv1I 74dYf/kYLhBt/ftN6HJuyWWpEFEfZh8zDBA1UxuTzSxmxS1Wx2bNXhkaQeP64RrX63II l/vg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=RsYcUWpQHPS1xjcGT6b3X+hEfz8TOnp6gTJgbESYK64=; b=aV16OSpsQ6EORHbSQ2q6YTS5sGkWDZhZqlAdy5UBW+OE+thbTXYbH8kAGIRPQznaR8 8CkjMS65FtNgg02TGB0tlljOf+ZL0kwvvzVaA6IbEZNCi0sEZ1MoUvql4wBNRfNDlsHM bgbXINTlvkwtxCQs6G5ZGIk38ZiW19MiIlv+0LwhIcfsBJvc5hBx/EHqt9N2zGRwCIi3 8sV8UklSAx8MEZX84uKy+Nvt8l5dWJfzrxvSo+Jh50GbIvof5TgTyYzG/IeM4w468qCi wVIUp5Q+Srk682HgbTxQvYQ3FO6etrfZkBYvjqDg4t3e8/Vi5Twq70rI8HWIzedKRc/L v+PA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e82-v6si15371710pfm.220.2018.06.18.02.52.20; Mon, 18 Jun 2018 02:52:33 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965117AbeFRIVl (ORCPT + 99 others); Mon, 18 Jun 2018 04:21:41 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:55354 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965094AbeFRIVj (ORCPT ); Mon, 18 Jun 2018 04:21:39 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 7F295C8D; Mon, 18 Jun 2018 08:21:38 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lijun Ou , Yixian Liu , Doug Ledford , Sasha Levin Subject: [PATCH 4.16 133/279] RDMA/hns: Bugfix for init hem table Date: Mon, 18 Jun 2018 10:11:58 +0200 Message-Id: <20180618080614.334226341@linuxfoundation.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180618080608.851973560@linuxfoundation.org> References: <20180618080608.851973560@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.16-stable review patch. If anyone has any objections, please let me know. ------------------ From: oulijun [ Upstream commit 215a8c09e5e2aa6ae1fbcef87f8f27d65d5d1ca4 ] During init hem table, type should be used instead of table->type which is finally initializaed with type. Signed-off-by: Lijun Ou Signed-off-by: Yixian Liu Signed-off-by: Doug Ledford Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/infiniband/hw/hns/hns_roce_hem.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/drivers/infiniband/hw/hns/hns_roce_hem.c +++ b/drivers/infiniband/hw/hns/hns_roce_hem.c @@ -912,7 +912,7 @@ int hns_roce_init_hem_table(struct hns_r obj_per_chunk = buf_chunk_size / obj_size; num_hem = (nobj + obj_per_chunk - 1) / obj_per_chunk; bt_chunk_num = bt_chunk_size / 8; - if (table->type >= HEM_TYPE_MTT) + if (type >= HEM_TYPE_MTT) num_bt_l0 = bt_chunk_num; table->hem = kcalloc(num_hem, sizeof(*table->hem), @@ -920,7 +920,7 @@ int hns_roce_init_hem_table(struct hns_r if (!table->hem) goto err_kcalloc_hem_buf; - if (check_whether_bt_num_3(table->type, hop_num)) { + if (check_whether_bt_num_3(type, hop_num)) { unsigned long num_bt_l1; num_bt_l1 = (num_hem + bt_chunk_num - 1) / @@ -939,8 +939,8 @@ int hns_roce_init_hem_table(struct hns_r goto err_kcalloc_l1_dma; } - if (check_whether_bt_num_2(table->type, hop_num) || - check_whether_bt_num_3(table->type, hop_num)) { + if (check_whether_bt_num_2(type, hop_num) || + check_whether_bt_num_3(type, hop_num)) { table->bt_l0 = kcalloc(num_bt_l0, sizeof(*table->bt_l0), GFP_KERNEL); if (!table->bt_l0)