From: Danil Kipnis <danil.kipnis@cloud.ionos.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Jinpu Wang <jinpu.wang@cloud.ionos.com>, linux-rdma@vger.kernel.org
Subject: Re: [bug report] RDMA/rtrs: server: main functionality
Date: Tue, 19 May 2020 17:07:00 +0200 [thread overview]
Message-ID: <CAHg0Huz39q9nWwTrtCY=SgU=T9oZJQdchx6c1LOPbSQiywzrqw@mail.gmail.com> (raw)
In-Reply-To: <20200519120209.GA42765@mwanda>
Hi Dan,
On Tue, May 19, 2020 at 2:02 PM Dan Carpenter <dan.carpenter@oracle.com> wrote:
>
> Hello Jack Wang,
>
> The patch 9cb837480424: "RDMA/rtrs: server: main functionality" from
> May 11, 2020, leads to the following static checker warning:
>
> drivers/infiniband/ulp/rtrs/rtrs-srv.c:1224 rtrs_srv_rdma_done()
> warn: array off by one? 'sess->mrs[msg_id]'
>
> drivers/infiniband/ulp/rtrs/rtrs-srv.c
> 1207 }
> 1208 rtrs_from_imm(be32_to_cpu(wc->ex.imm_data),
> 1209 &imm_type, &imm_payload);
> 1210 if (likely(imm_type == RTRS_IO_REQ_IMM)) {
> 1211 u32 msg_id, off;
> 1212 void *data;
> 1213
> 1214 msg_id = imm_payload >> sess->mem_bits;
> 1215 off = imm_payload & ((1 << sess->mem_bits) - 1);
> 1216 if (unlikely(msg_id > srv->queue_depth ||
> ^
> This should definitely be >=
Definitely, thank you.
>
> 1217 off > max_chunk_size)) {
> ^
> My only question is should "off" be >=. I feel like probably it should
> but I'm not sure.
Here also, yes.
>
> 1218 rtrs_err(s, "Wrong msg_id %u, off %u\n",
> 1219 msg_id, off);
> 1220 close_sess(sess);
> 1221 return;
> 1222 }
> 1223 if (always_invalidate) {
> 1224 struct rtrs_srv_mr *mr = &sess->mrs[msg_id];
> ^^^^^^^^^^^^^^^^^^
> 1225
> 1226 mr->msg_off = off;
> 1227 mr->msg_id = msg_id;
> 1228 err = rtrs_srv_inv_rkey(con, mr);
> 1229 if (unlikely(err)) {
> 1230 rtrs_err(s, "rtrs_post_recv(), err: %d\n",
> 1231 err);
> 1232 close_sess(sess);
> 1233 break;
> 1234 }
> 1235 } else {
> 1236 data = page_address(srv->chunks[msg_id]) + off;
> 1237 process_io_req(con, data, msg_id, off);
> 1238 }
> 1239 } else if (imm_type == RTRS_HB_MSG_IMM) {
> 1240 WARN_ON(con->c.cid);
> 1241 rtrs_send_hb_ack(&sess->s);
> 1242 } else if (imm_type == RTRS_HB_ACK_IMM) {
>
> regards,
> dan carpenter
next prev parent reply other threads:[~2020-05-19 15:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-19 12:02 [bug report] RDMA/rtrs: server: main functionality Dan Carpenter
2020-05-19 15:07 ` Danil Kipnis [this message]
2020-05-19 15:45 ` [PATCH] RDMA/rtrs: Fix a couple off by one bugs in rtrs_srv_rdma_done() Dan Carpenter
2020-05-19 16:00 ` Danil Kipnis
2020-05-19 23:46 ` 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='CAHg0Huz39q9nWwTrtCY=SgU=T9oZJQdchx6c1LOPbSQiywzrqw@mail.gmail.com' \
--to=danil.kipnis@cloud.ionos.com \
--cc=dan.carpenter@oracle.com \
--cc=jinpu.wang@cloud.ionos.com \
--cc=linux-rdma@vger.kernel.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 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).