From: liweihang <liweihang@huawei.com>
To: Jason Gunthorpe <jgg@nvidia.com>
Cc: "dledford@redhat.com" <dledford@redhat.com>,
"leon@kernel.org" <leon@kernel.org>,
"linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>,
Linuxarm <linuxarm@huawei.com>
Subject: Re: [PATCH v2 for-next 6/9] RDMA/hns: Solve the overflow of the calc_pg_sz()
Date: Sat, 19 Sep 2020 03:04:10 +0000 [thread overview]
Message-ID: <06b3caf217744f33a47655dec697400a@huawei.com> (raw)
In-Reply-To: 20200918141054.GB305257@nvidia.com
On 2020/9/18 22:11, Jason Gunthorpe wrote:
> On Wed, Sep 09, 2020 at 04:57:31PM +0800, Weihang Li wrote:
>> From: Jiaran Zhang <zhangjiaran@huawei.com>
>>
>> calc_pg_sz() may gets a data calculation overflow if the PAGE_SIZE is 64 KB
>> and hop_num is 2. It is because that all variables involved in calculation
>> are defined in type of int. So change the type of bt_chunk_size,
>> buf_chunk_size and obj_per_chunk_default to u64.
>>
>> Fixes: ba6bb7e97421 ("RDMA/hns: Add interfaces to get pf capabilities from firmware")
>> Signed-off-by: Jiaran Zhang <zhangjiaran@huawei.com>
>> Signed-off-by: Weihang Li <liweihang@huawei.com>
>> drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 6 +++---
>> 1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
>> index 01aabb7..af2dea1 100644
>> +++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
>> @@ -1804,9 +1804,9 @@ static void calc_pg_sz(int obj_num, int obj_size, int hop_num, int ctx_bt_num,
>> int *buf_page_size, int *bt_page_size, u32 hem_type)
>> {
>> u64 obj_per_chunk;
>> - int bt_chunk_size = 1 << PAGE_SHIFT;
>> - int buf_chunk_size = 1 << PAGE_SHIFT;
>> - int obj_per_chunk_default = buf_chunk_size / obj_size;
>> + u64 bt_chunk_size = 1 << PAGE_SHIFT;
>> + u64 buf_chunk_size = 1 << PAGE_SHIFT;
>
> This is PAGE_SIZE
>
> Jason
>
Thanks for your reminder, I fill fix it.
Weihang
next prev parent reply other threads:[~2020-09-19 3:04 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-09 8:57 [PATCH v2 for-next 0/9] RDMA/hns: Misc Updates Weihang Li
2020-09-09 8:57 ` [PATCH v2 for-next 1/9] RDMA/hns: Refactor process about opcode in post_send() Weihang Li
2020-09-18 13:47 ` Jason Gunthorpe
2020-09-19 2:35 ` liweihang
2020-09-09 8:57 ` [PATCH v2 for-next 2/9] RDMA/hns: Add type check in get/set hw field Weihang Li
2020-09-18 13:49 ` Jason Gunthorpe
2020-09-19 8:28 ` liweihang
2020-09-09 8:57 ` [PATCH v2 for-next 3/9] RDMA/hns: Add interception for resizing SRQs Weihang Li
2020-09-18 14:06 ` Jason Gunthorpe
2020-09-19 2:44 ` liweihang
2020-09-09 8:57 ` [PATCH v2 for-next 4/9] RDMA/hns: Correct typo of hns_roce_create_cq() Weihang Li
2020-09-18 14:09 ` Jason Gunthorpe
2020-09-19 2:44 ` liweihang
2020-09-09 8:57 ` [PATCH v2 for-next 5/9] RDMA/hns: Add check for the validity of sl configuration Weihang Li
2020-09-18 14:11 ` Jason Gunthorpe
2020-09-19 2:45 ` liweihang
2020-09-09 8:57 ` [PATCH v2 for-next 6/9] RDMA/hns: Solve the overflow of the calc_pg_sz() Weihang Li
2020-09-18 14:10 ` Jason Gunthorpe
2020-09-19 3:04 ` liweihang [this message]
2020-09-09 8:57 ` [PATCH v2 for-next 7/9] RDMA/hns: Fix the wrong value of rnr_retry when querying qp Weihang Li
2020-09-09 8:57 ` [PATCH v2 for-next 8/9] RDMA/hns: Fix configuration of ack_req_freq in QPC Weihang Li
2020-09-09 8:57 ` [PATCH v2 for-next 9/9] RDMA/hns: Fix missing sq_sig_type when querying QP Weihang Li
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=06b3caf217744f33a47655dec697400a@huawei.com \
--to=liweihang@huawei.com \
--cc=dledford@redhat.com \
--cc=jgg@nvidia.com \
--cc=leon@kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=linuxarm@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.