From: Dan Carpenter <dan.carpenter@oracle.com>
To: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Lijun Ou <oulijun@huawei.com>,
"Wei Hu(Xavier)" <xavier.huwei@huawei.com>,
Doug Ledford <dledford@redhat.com>,
linux-rdma@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] RDMA/hns: prevent undefined behavior in hns_roce_set_user_sq_size()
Date: Thu, 24 Oct 2019 21:20:39 +0300 [thread overview]
Message-ID: <20191024182039.GB23523@kadam> (raw)
In-Reply-To: <20191024163749.GX23952@ziepe.ca>
On Thu, Oct 24, 2019 at 01:37:49PM -0300, Jason Gunthorpe wrote:
> On Mon, Oct 07, 2019 at 03:18:22PM +0300, Dan Carpenter wrote:
> > This one still needs to be applied.
> >
> > regards,
> > dan carpenter
>
> Weird, it is marked changes requested in patchworks. An email must
> have been lost??
>
Maybe you replied to a different thread?
> I think I probably wanted to say that:
>
> > > /* Sanity check SQ size before proceeding */
> > > - if ((u32)(1 << ucmd->log_sq_bb_count) > hr_dev->caps.max_wqes ||
> > > + if (ucmd->log_sq_bb_count > 31 ||
> > > + (u32)(1 << ucmd->log_sq_bb_count) > hr_dev->caps.max_wqes
> > > ||
>
> Overall should probably be coded using check_shl_overflow(), as this
> later shift:
>
> hr_qp->sq.wqe_cnt = 1 << ucmd->log_sq_bb_count;
>
> Is storing it into an int and hardwring '31' because it magically
> matches that lower shift is pretty fragile.
>
> More like this?
>
Yeah. I like your patch. I'd feel silly claiming authorship though.
I'm willing to, because it's nice, but probably you should just give me
Reported-by credit instead.
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
regards,
dan carpenter
next prev parent reply other threads:[~2019-10-24 18:21 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20190608092514.GC28890@mwanda>
2019-10-07 12:18 ` [PATCH] RDMA/hns: prevent undefined behavior in hns_roce_set_user_sq_size() Dan Carpenter
2019-10-24 16:37 ` Jason Gunthorpe
2019-10-24 18:20 ` Dan Carpenter [this message]
2019-10-28 14:23 ` Jason Gunthorpe
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=20191024182039.GB23523@kadam \
--to=dan.carpenter@oracle.com \
--cc=dledford@redhat.com \
--cc=jgg@ziepe.ca \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=oulijun@huawei.com \
--cc=xavier.huwei@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).