Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp1860524rwb; Fri, 19 Aug 2022 10:35:19 -0700 (PDT) X-Google-Smtp-Source: AA6agR7XWCwG5bcVthPd/1lY4n5XYXdhoLA4UZ42+pN4tRtI4ob2U33JlSrGjdZ4hsb9DHu/L2+z X-Received: by 2002:a63:4547:0:b0:41d:ba0a:870a with SMTP id u7-20020a634547000000b0041dba0a870amr7233214pgk.216.1660930519541; Fri, 19 Aug 2022 10:35:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660930519; cv=none; d=google.com; s=arc-20160816; b=uWQK9Uk0CgM1D5iSCEFS42zJgeudr3MD4djv/S29gd+bKuE++Y+Be6+fX5b8CwefTt QuFPLMDncb9FcJv2yDH53/a6mXx5VkJAvbNzIq7gFr6NsZ2R+2uC3TTaWLxfiNSabLQa KYskg42VyGSH+mrv5wQMg0hJ9G9SU8fvwp+yF+HbVTuxY9IAIGCoAXk1Lk87t2OzFRzR 1z6AmPNkrf2O+QctVGbp/qagCMbm1x0r/78X9iUOvOCThSvtcQ4xtXSs3eK2gjDE+Fqk R/Wl+Qg4UkX24qyzjB+hb2h8fUciaRnTI5yDelyBMW91vTlOzkiPp+0hbfrWkkMxc79O oZxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=I+gdpQptUTXTs2MTCo3wUNpy7nRZHjbEvoNND5ociFs=; b=ge5Rzqva8ZhFQU2I0rN7c2PjSZMSYn+dQyPmmaYQY315PkFQrh3ljj8ViEA5eZzS0e qxJ8bMS8Xmd7USfAYWs79/7Xh++hTd+2PBIpOI3IlGPzY0gn49N0n4relN0ZBSvybnhI HR6RXtBGkfYN+W4hK6U/o+cl4z9hD9DbQgK1XUKRkHEOWB6uodjJZ233/HzuCcyDvGFm /IdDhfaB08FbGivIw5aqEd9+12f3OGNSPpR1fhqKx/nm/SrezUgKcPi41v6B2inZRspG KOsYtK+D2fwnIvVcRzI15TJoV8IZ+XpV+X0aGvrV6GvqkWCP5F1NVA+eMO97rL6OhYbs PxRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Yjnsa7Eh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b17-20020a170903229100b001586190b7c1si2091824plh.528.2022.08.19.10.35.08; Fri, 19 Aug 2022 10:35:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Yjnsa7Eh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352921AbiHSQZu (ORCPT + 99 others); Fri, 19 Aug 2022 12:25:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352481AbiHSQVG (ORCPT ); Fri, 19 Aug 2022 12:21:06 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 49A33B1F1; Fri, 19 Aug 2022 09:02:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0C189B82812; Fri, 19 Aug 2022 16:02:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6B66EC433C1; Fri, 19 Aug 2022 16:02:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660924947; bh=Uyn+X1OwbaITjamq4ta4a4Xbpn8zh6/jOe2ZakygT90=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Yjnsa7EhYLp2XOEh7xzErOh3xS9DCbKc3lDJiLxDpRbPK/gQRScFrwnnp+53597RJ ooIoLYUS3ugoiJsQZMiSRXbnX0o2IZRwCoRYAQgmFgmdYq+YPJ6/IeB5sPu1ClRJjW OZXZAu1EaBd1a/cn2mNvP5dYVnYtC2bEQ2ElCRKo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jack Wang , Jason Gunthorpe , Sasha Levin Subject: [PATCH 5.10 333/545] RDMA/rtrs: Avoid Wtautological-constant-out-of-range-compare Date: Fri, 19 Aug 2022 17:41:43 +0200 Message-Id: <20220819153844.289126654@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220819153829.135562864@linuxfoundation.org> References: <20220819153829.135562864@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jack Wang [ Upstream commit 0e8558476faf02ec51256cad9c487c93c346198c ] 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. Link: https://lore.kernel.org/r/20210531122835.58329-1-jinpu.wang@ionos.com Signed-off-by: Jack Wang Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin --- 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 13634eda833d..5c39e4c4bef7 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs-clt.c +++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.c @@ -1728,11 +1728,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 333de9d52172..77e98ff9008a 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.35.1