From: Leon Romanovsky <leon-2ukJVAZIZ/Y@public.gmane.org>
To: Mustafa Ismail <mustafa.ismail-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
e1000-rdma-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: Re: [RDMA PATCH 01/16] RDMA/i40iw: Fix overflow of region length
Date: Mon, 18 Apr 2016 09:51:07 +0300 [thread overview]
Message-ID: <20160418065107.GH6349@leon.nu> (raw)
In-Reply-To: <1460557852-10824-2-git-send-email-mustafa.ismail-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 2444 bytes --]
On Wed, Apr 13, 2016 at 09:30:37AM -0500, Mustafa Ismail wrote:
> Change region_length to u64 as a region can be > 4GB.
>
> Signed-off-by: Mustafa Ismail <mustafa.ismail-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> ---
> drivers/infiniband/hw/i40iw/i40iw_user.h | 2 ++
> drivers/infiniband/hw/i40iw/i40iw_verbs.c | 8 +++++---
> 2 files changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/infiniband/hw/i40iw/i40iw_user.h b/drivers/infiniband/hw/i40iw/i40iw_user.h
> index 5cd971b..eac9524 100644
> --- a/drivers/infiniband/hw/i40iw/i40iw_user.h
> +++ b/drivers/infiniband/hw/i40iw/i40iw_user.h
> @@ -102,6 +102,8 @@ enum i40iw_device_capabilities_const {
>
> #define I40IW_STAG_INDEX_FROM_STAG(stag) (((stag) && 0xFFFFFF00) >> 8)
>
> +#define I40IW_MAX_MR_SIZE 0x10000000000L
> +
> struct i40iw_qp_uk;
> struct i40iw_cq_uk;
> struct i40iw_srq_uk;
> diff --git a/drivers/infiniband/hw/i40iw/i40iw_verbs.c b/drivers/infiniband/hw/i40iw/i40iw_verbs.c
> index 1fe3b84..d7c4dd1 100644
> --- a/drivers/infiniband/hw/i40iw/i40iw_verbs.c
> +++ b/drivers/infiniband/hw/i40iw/i40iw_verbs.c
> @@ -1526,14 +1526,16 @@ static struct ib_mr *i40iw_reg_user_mr(struct ib_pd *pd,
> struct i40iw_mr *iwmr;
> struct ib_umem *region;
> struct i40iw_mem_reg_req req;
> - u32 pbl_depth = 0;
> + u64 pbl_depth = 0;
> u32 stag = 0;
> u16 access;
> - u32 region_length;
> + u64 region_length;
> bool use_pbles = false;
> unsigned long flags;
> int err = -ENOSYS;
>
> + if (length > I40IW_MAX_MR_SIZE)
> + return ERR_PTR(-EINVAL);
> region = ib_umem_get(pd->uobject->context, start, length, acc, 0);
> if (IS_ERR(region))
> return (struct ib_mr *)region;
> @@ -1564,7 +1566,7 @@ static struct ib_mr *i40iw_reg_user_mr(struct ib_pd *pd,
> palloc = &iwpbl->pble_alloc;
>
> iwmr->type = req.reg_type;
> - iwmr->page_cnt = pbl_depth;
> + iwmr->page_cnt = (u32)pbl_depth;
The cleanest approach will be to use lower_32_bits() macro, however both
options are valid.
Reviewed-by: Leon Romanvsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
>
> switch (req.reg_type) {
> case IW_MEMREG_TYPE_QP:
> --
> 2.7.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2016-04-18 6:51 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-13 14:30 [RDMA PATCH 00/16] RDMA/Intel X722 iWARP driver update Mustafa Ismail
[not found] ` <1460557852-10824-1-git-send-email-mustafa.ismail-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-04-13 14:30 ` [RDMA PATCH 01/16] RDMA/i40iw: Fix overflow of region length Mustafa Ismail
[not found] ` <1460557852-10824-2-git-send-email-mustafa.ismail-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-04-18 6:51 ` Leon Romanovsky [this message]
2016-04-13 14:30 ` [RDMA PATCH 02/16] RDMA/i40iw: Correct QP size calculation Mustafa Ismail
2016-04-13 14:30 ` [RDMA PATCH 03/16] RDMA/i40iw: Fix refused connections Mustafa Ismail
2016-04-13 14:30 ` [RDMA PATCH 04/16] RDMA/i40iw: Correct max message size in query port Mustafa Ismail
2016-04-13 14:30 ` [RDMA PATCH 05/16] RDMA/i40iw: Do not set self-referencing pointer to NULL after free Mustafa Ismail
2016-04-13 14:30 ` [RDMA PATCH 06/16] RDMA/i40iw: Add qp table lock around AE processing Mustafa Ismail
2016-04-13 14:30 ` [RDMA PATCH 07/16] RDMA/i40iw: Set vendor_err only if there is an actual error Mustafa Ismail
2016-04-13 14:30 ` [RDMA PATCH 08/16] RDMA/i40iw: Populate vendor_id and vendor_part_id fields Mustafa Ismail
2016-04-13 14:30 ` [RDMA PATCH 09/16] RDMA/i40iw: Remove unused code and fix warning Mustafa Ismail
2016-04-13 14:30 ` [RDMA PATCH 10/16] RDMA/i40iw: Add virtual channel message queue Mustafa Ismail
2016-04-13 14:30 ` [RDMA PATCH 11/16] RDMA/i40iw: Correct return code check in add_pble_pool Mustafa Ismail
2016-04-13 14:30 ` [RDMA PATCH 12/16] RDMA/i40iw: Initialize max enabled vfs variable Mustafa Ismail
2016-04-13 14:30 ` [RDMA PATCH 13/16] RDMA/i40iw: Add base memory management extensions Mustafa Ismail
2016-04-13 14:30 ` [RDMA PATCH 14/16] RDMA/i40iw: Fix endian issues and warnings Mustafa Ismail
2016-04-13 14:30 ` [RDMA PATCH 15/16] RDMA/i40iw: Fix SD calculation for initial HMC creation Mustafa Ismail
2016-04-13 14:30 ` [RDMA PATCH 16/16] RDMA/i40iw: Adding queue drain functions Mustafa Ismail
2016-04-17 14:07 ` [RDMA PATCH 00/16] RDMA/Intel X722 iWARP driver update Leon Romanovsky
2016-04-18 6:56 ` Leon Romanovsky
2016-05-13 20:07 ` Doug Ledford
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=20160418065107.GH6349@leon.nu \
--to=leon-2ukjvaziz/y@public.gmane.org \
--cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=e1000-rdma-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=mustafa.ismail-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
/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.