diff mbox

[RDMA,01/16] i40iw: Fix overflow of region length

Message ID 1460046664-552-2-git-send-email-mustafa.ismail@intel.com (mailing list archive)
State Superseded
Headers show

Commit Message

Ismail, Mustafa April 7, 2016, 4:30 p.m. UTC
Change region_length to u64 as a region can be > 4GB.

Signed-off-by: Mustafa Ismail <mustafa.ismail@intel.com>
---
 drivers/infiniband/hw/i40iw/i40iw_verbs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Leon Romanovsky April 11, 2016, 9:23 a.m. UTC | #1
On Thu, Apr 07, 2016 at 11:30:49AM -0500, Mustafa Ismail wrote:
> Change region_length to u64 as a region can be > 4GB.

I suppose that you will have a casting warning while setting u64 variable to u32 variable.
$grep -r pbl_depth drivers/infiniband/hw/i40iw/*
drivers/infiniband/hw/i40iw/i40iw_verbs.c:      u32 pbl_depth = 0;
drivers/infiniband/hw/i40iw/i40iw_verbs.c:      pbl_depth = region_length >> 12;
Ismail, Mustafa April 12, 2016, 6:09 p.m. UTC | #2
On Mon, Apr 11, 2016 at 02:23:24AM -0700, Leon Romanovsky wrote:
> On Thu, Apr 07, 2016 at 11:30:49AM -0500, Mustafa Ismail wrote:
> > Change region_length to u64 as a region can be > 4GB.
> 
> I suppose that you will have a casting warning while setting u64 variable to u32 variable.
> $grep -r pbl_depth drivers/infiniband/hw/i40iw/*
> drivers/infiniband/hw/i40iw/i40iw_verbs.c:      u32 pbl_depth = 0;
> drivers/infiniband/hw/i40iw/i40iw_verbs.c:      pbl_depth = region_length >> 12;

I did not see any warnings from zero day testing. Good catch. We will fix in V2.
Thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/infiniband/hw/i40iw/i40iw_verbs.c b/drivers/infiniband/hw/i40iw/i40iw_verbs.c
index 1fe3b84..78da3eb 100644
--- a/drivers/infiniband/hw/i40iw/i40iw_verbs.c
+++ b/drivers/infiniband/hw/i40iw/i40iw_verbs.c
@@ -1529,7 +1529,7 @@  static struct ib_mr *i40iw_reg_user_mr(struct ib_pd *pd,
 	u32 pbl_depth = 0;
 	u32 stag = 0;
 	u16 access;
-	u32 region_length;
+	u64 region_length;
 	bool use_pbles = false;
 	unsigned long flags;
 	int err = -ENOSYS;