Re: [PATCH] vmw_pvrdma: Avoid rounding up of sge count to power of 2

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

 



On Fri, Feb 16, 2018 at 09:15:26AM -0700, Jason Gunthorpe wrote:
> On Thu, Feb 15, 2018 at 04:39:52PM -0800, Adit Ranadive wrote:
> > Creation of resources can fail if the rounding up exceeds
> > provider supported values.
> >
> > Fixes: 4c8ed14eb6b7 ("vmw_pvrdma: Add SRQ support")
> > Reviewed-by: Bryan Tan <bryantan@xxxxxxxxxx>
> > Reviewed-by: Nitish Bhat <bnitish@xxxxxxxxxx>
> > Signed-off-by: Adit Ranadive <aditr@xxxxxxxxxx>
> > Cc: stable@xxxxxxxxxxxxxx
> >  providers/vmw_pvrdma/qp.c | 8 +++-----
> >  1 file changed, 3 insertions(+), 5 deletions(-)
> >
> > diff --git a/providers/vmw_pvrdma/qp.c b/providers/vmw_pvrdma/qp.c
> > index efcc99b..4b9f897 100644
> > +++ b/providers/vmw_pvrdma/qp.c
> > @@ -113,7 +113,7 @@ struct ibv_srq *pvrdma_create_srq(struct ibv_pd *pd,
> >  	int ret;
> >
> >  	attr->attr.max_wr = align_next_power2(max_t(uint32_t, 1U, attr->attr.max_wr));
> > -	attr->attr.max_sge = align_next_power2(max_t(uint32_t, 1U, attr->attr.max_sge));
> > +	attr->attr.max_sge = max_t(uint32_t, 1U, attr->attr.max_sge);
>
> What is with all these max's? If the user provides <= 0 for these
> values it should be EINVAL, not round up.

SRQ attributes are uint32_t, user can't provide negative values.

 680 struct ibv_srq_attr {
 681         uint32_t                max_wr;
 682         uint32_t                max_sge;
 683         uint32_t                srq_limit;
 684 };

Thanks

>
> Jason
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux