Patch "RDMA/hns: Solve the overflow of the calc_pg_sz()" has been added to the 5.8-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    RDMA/hns: Solve the overflow of the calc_pg_sz()

to the 5.8-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     rdma-hns-solve-the-overflow-of-the-calc_pg_sz.patch
and it can be found in the queue-5.8 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 53119405f4ba51f273e8f4284c0787788e7fd887
Author: Jiaran Zhang <zhangjiaran@xxxxxxxxxx>
Date:   Sat Sep 19 18:03:19 2020 +0800

    RDMA/hns: Solve the overflow of the calc_pg_sz()
    
    [ Upstream commit 768202a0825d447de785e87ff1ea1d3c86a71727 ]
    
    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")
    Link: https://lore.kernel.org/r/1600509802-44382-6-git-send-email-liweihang@xxxxxxxxxx
    Signed-off-by: Jiaran Zhang <zhangjiaran@xxxxxxxxxx>
    Signed-off-by: Weihang Li <liweihang@xxxxxxxxxx>
    Signed-off-by: Jason Gunthorpe <jgg@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
index 0f995aa23b9a9..fdd9605c67630 100644
--- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
+++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
@@ -1770,9 +1770,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 = PAGE_SIZE;
+	u64 buf_chunk_size = PAGE_SIZE;
+	u64 obj_per_chunk_default = buf_chunk_size / obj_size;
 
 	*buf_page_size = 0;
 	*bt_page_size = 0;



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux