* [PATCH] RDMA/rtrs: Avoid Wtautological-constant-out-of-range-compare
@ 2021-05-31 12:28 Jack Wang
2021-05-31 18:43 ` Jason Gunthorpe
0 siblings, 1 reply; 3+ messages in thread
From: Jack Wang @ 2021-05-31 12:28 UTC (permalink / raw)
To: linux-rdma
Cc: bvanassche, leon, dledford, jgg, haris.iqbal, gi-oh.kim, jinpu.wang
drivers/infiniband/ulp/rtrs/rtrs-clt.c:1786:19: warning: result of comparison of
constant 'MAX_SESS_QUEUE_DEPTH' (65536) with expression of type 'u16'
(aka 'unsigned short') is always false [-Wtautological-constant-out-of-range-compare]
To fix it, limit MAX_SESS_QUEUE_DEPTH to u16 max, which is 65535, and
drop the check in rtrs-clt, as it's the type u16 max.
Signed-off-by: Jack Wang <jinpu.wang@ionos.com>
---
drivers/infiniband/ulp/rtrs/rtrs-clt.c | 5 -----
drivers/infiniband/ulp/rtrs/rtrs-pri.h | 4 ++--
2 files changed, 2 insertions(+), 7 deletions(-)
diff --git a/drivers/infiniband/ulp/rtrs/rtrs-clt.c b/drivers/infiniband/ulp/rtrs/rtrs-clt.c
index 8e05a71d8da1..f1fd7ae9ac53 100644
--- a/drivers/infiniband/ulp/rtrs/rtrs-clt.c
+++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.c
@@ -1775,11 +1775,6 @@ static int rtrs_rdma_conn_established(struct rtrs_clt_con *con,
if (con->c.cid == 0) {
queue_depth = le16_to_cpu(msg->queue_depth);
- if (queue_depth > MAX_SESS_QUEUE_DEPTH) {
- rtrs_err(clt, "Invalid RTRS message: queue=%d\n",
- queue_depth);
- return -ECONNRESET;
- }
if (sess->queue_depth > 0 && queue_depth != sess->queue_depth) {
rtrs_err(clt, "Error: queue depth changed\n");
diff --git a/drivers/infiniband/ulp/rtrs/rtrs-pri.h b/drivers/infiniband/ulp/rtrs/rtrs-pri.h
index 1705197b8c22..bd06a79fd516 100644
--- a/drivers/infiniband/ulp/rtrs/rtrs-pri.h
+++ b/drivers/infiniband/ulp/rtrs/rtrs-pri.h
@@ -53,9 +53,9 @@ enum {
* But mempool_create, create_qp and ib_post_send fail with
* "cannot allocate memory" error if sess_queue_depth is too big.
* Therefore the pratical max value of sess_queue_depth is
- * somewhere between 1 and 65536 and it depends on the system.
+ * somewhere between 1 and 65534 and it depends on the system.
*/
- MAX_SESS_QUEUE_DEPTH = 65536,
+ MAX_SESS_QUEUE_DEPTH = 65535,
MIN_CHUNK_SIZE = 8192,
RTRS_HB_INTERVAL_MS = 5000,
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] RDMA/rtrs: Avoid Wtautological-constant-out-of-range-compare
2021-05-31 12:28 [PATCH] RDMA/rtrs: Avoid Wtautological-constant-out-of-range-compare Jack Wang
@ 2021-05-31 18:43 ` Jason Gunthorpe
2021-06-01 5:02 ` Jinpu Wang
0 siblings, 1 reply; 3+ messages in thread
From: Jason Gunthorpe @ 2021-05-31 18:43 UTC (permalink / raw)
To: Jack Wang; +Cc: linux-rdma, bvanassche, leon, dledford, haris.iqbal, gi-oh.kim
On Mon, May 31, 2021 at 02:28:35PM +0200, Jack Wang wrote:
> drivers/infiniband/ulp/rtrs/rtrs-clt.c:1786:19: warning: result of comparison of
> constant 'MAX_SESS_QUEUE_DEPTH' (65536) with expression of type 'u16'
> (aka 'unsigned short') is always false [-Wtautological-constant-out-of-range-compare]
>
> To fix it, limit MAX_SESS_QUEUE_DEPTH to u16 max, which is 65535, and
> drop the check in rtrs-clt, as it's the type u16 max.
>
> Signed-off-by: Jack Wang <jinpu.wang@ionos.com>
> ---
> drivers/infiniband/ulp/rtrs/rtrs-clt.c | 5 -----
> drivers/infiniband/ulp/rtrs/rtrs-pri.h | 4 ++--
> 2 files changed, 2 insertions(+), 7 deletions(-)
I kept the patch as is since the first hunk gets wonky conflicts if it
is squashed
Jason
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] RDMA/rtrs: Avoid Wtautological-constant-out-of-range-compare
2021-05-31 18:43 ` Jason Gunthorpe
@ 2021-06-01 5:02 ` Jinpu Wang
0 siblings, 0 replies; 3+ messages in thread
From: Jinpu Wang @ 2021-06-01 5:02 UTC (permalink / raw)
To: Jason Gunthorpe
Cc: RDMA mailing list, Bart Van Assche, Leon Romanovsky,
Doug Ledford, Haris Iqbal, Gioh Kim
On Mon, May 31, 2021 at 8:43 PM Jason Gunthorpe <jgg@ziepe.ca> wrote:
>
> On Mon, May 31, 2021 at 02:28:35PM +0200, Jack Wang wrote:
> > drivers/infiniband/ulp/rtrs/rtrs-clt.c:1786:19: warning: result of comparison of
> > constant 'MAX_SESS_QUEUE_DEPTH' (65536) with expression of type 'u16'
> > (aka 'unsigned short') is always false [-Wtautological-constant-out-of-range-compare]
> >
> > To fix it, limit MAX_SESS_QUEUE_DEPTH to u16 max, which is 65535, and
> > drop the check in rtrs-clt, as it's the type u16 max.
> >
> > Signed-off-by: Jack Wang <jinpu.wang@ionos.com>
> > ---
> > drivers/infiniband/ulp/rtrs/rtrs-clt.c | 5 -----
> > drivers/infiniband/ulp/rtrs/rtrs-pri.h | 4 ++--
> > 2 files changed, 2 insertions(+), 7 deletions(-)
>
> I kept the patch as is since the first hunk gets wonky conflicts if it
> is squashed
>
> Jason
Thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-06-01 5:02 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-31 12:28 [PATCH] RDMA/rtrs: Avoid Wtautological-constant-out-of-range-compare Jack Wang
2021-05-31 18:43 ` Jason Gunthorpe
2021-06-01 5:02 ` Jinpu Wang
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.