Message ID | 20230303124408.16685-1-n.petrova@fintech.ru |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp388696wrd; Fri, 3 Mar 2023 04:47:43 -0800 (PST) X-Google-Smtp-Source: AK7set/4O4jmLXAONZz2V7j7Pp0ylfdLAcEOQhYsUczNJl2aGMuv4tX2jyslD19Rnadh3LDLMgWe X-Received: by 2002:a17:902:f693:b0:19c:ff5d:1fd2 with SMTP id l19-20020a170902f69300b0019cff5d1fd2mr1664207plg.8.1677847663036; Fri, 03 Mar 2023 04:47:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677847663; cv=none; d=google.com; s=arc-20160816; b=xXDA6oGRTs56InM1aLyv7QG7MMzMtA218KANTYfLFSvSDjX9RFy8bVJjca5gMepA7z VtC0FU0yuCPZkqwLfRIfoCkg9wR5Bn1YmBGNN0UBSBhrpoC3LjXazaLKPPk+d1k+3cmb CFHaWNMinF5DIxP23ADdc0x3R9eiCad0LzBStRTUY2E8kwIXlrLue5XNDuwJgC3CBTcL EsuNGLE6HJhvfmG1gT42AAgDtTt5GqmQ8MMDx8BEeKrGyWLoH7+ZpRu66PtvRmkmWHZn w4wsfi5TjtEQTDdeQP3SMoFfXNpChRC+qe4WMuJuSAkMjwXUag1oP0vW+kYxpQWaLYp4 gXug== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=qUmfvTWt7FJZvgvPxRCxAKcM0LkzmAaO6Rj3GIrWTp8=; b=iMHOqaKSHyJCPzp5l23g18IpN5ZgVT/1tekAHIP0OjtUm7tpj+WxqnFZRghRCBFXik Y+JtDI6BE09WK2BRNfznjaXnJiufh7TXFqAzhb4f8Tsp0sEKdkMlRToc3kjRgL7wctOu KPx5Jd2yBbwkNM7MHl/ppzyzRVjx1IBhHhORFF9bqqcSlMQBlIaiVtEVNGcJb6vGLLjy lk13g2oPA6nk8DO0jxTjuIUEJiqZjey3o3XH2po4la0gQO1GNJxITvdfyk4zmKgiXxXJ sIuvsuz734zJDW6zqXysUzB7FgnT5Q0D6f5rVuL3xPllCfKXAMcFUvA03Z/zR9cyp6ul Q8Jg== ARC-Authentication-Results: i=1; mx.google.com; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kr12-20020a170903080c00b0019cdbe4750bsi1957225plb.442.2023.03.03.04.47.29; Fri, 03 Mar 2023 04:47:43 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229987AbjCCMoS (ORCPT <rfc822;davidbtadokoro@gmail.com> + 99 others); Fri, 3 Mar 2023 07:44:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56518 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229451AbjCCMoR (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 3 Mar 2023 07:44:17 -0500 Received: from exchange.fintech.ru (e10edge.fintech.ru [195.54.195.159]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F28991815F; Fri, 3 Mar 2023 04:44:14 -0800 (PST) Received: from Ex16-01.fintech.ru (10.0.10.18) by exchange.fintech.ru (195.54.195.159) with Microsoft SMTP Server (TLS) id 14.3.498.0; Fri, 3 Mar 2023 15:44:11 +0300 Received: from KANASHIN1.fintech.ru (10.0.253.125) by Ex16-01.fintech.ru (10.0.10.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.4; Fri, 3 Mar 2023 15:44:11 +0300 From: Natalia Petrova <n.petrova@fintech.ru> To: Dennis Dalessandro <dennis.dalessandro@cornelisnetworks.com> CC: Natalia Petrova <n.petrova@fintech.ru>, Jason Gunthorpe <jgg@ziepe.ca>, Leon Romanovsky <leon@kernel.org>, <linux-rdma@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <ldv-project@linuxtesting.org> Subject: [PATCH v2] rdmavt: delete unnecessary NULL check Date: Fri, 3 Mar 2023 15:44:08 +0300 Message-ID: <20230303124408.16685-1-n.petrova@fintech.ru> X-Mailer: git-send-email 2.34.1 In-Reply-To: <4c6939b5-05b9-1346-5376-82011b4cc093@cornelisnetworks.com> References: MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.0.253.125] X-ClientProxiedBy: Ex16-02.fintech.ru (10.0.10.19) To Ex16-01.fintech.ru (10.0.10.18) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759350790799286717?= X-GMAIL-MSGID: =?utf-8?q?1759350790799286717?= |
Series |
[v2] rdmavt: delete unnecessary NULL check
|
|
Commit Message
Natalia Petrova
March 3, 2023, 12:44 p.m. UTC
There is no need to check 'rdi->qp_dev' for NULL. The field 'qp_dev'
is created in rvt_register_device() which will fail if the 'qp_dev'
allocation fails in rvt_driver_qp_init(). Overwise this pointer
doesn't changed and passed to rvt_qp_exit() by the next step.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Fixes: 0acb0cc7ecc1 ("IB/rdmavt: Initialize and teardown of qpn table")
Signed-off-by: Natalia Petrova <n.petrova@fintech.ru>
---
v2: The remark about non-null value of 'rdi->qp_dev' by Leon Romanovsky <leon@kernel.org>
and Dennis Dalessandro <dennis.dalessandro@cornelisnetworks.com> was taken into account.
drivers/infiniband/sw/rdmavt/qp.c | 2 --
1 file changed, 2 deletions(-)
Comments
On Fri, 03 Mar 2023 15:44:08 +0300, Natalia Petrova wrote: > There is no need to check 'rdi->qp_dev' for NULL. The field 'qp_dev' > is created in rvt_register_device() which will fail if the 'qp_dev' > allocation fails in rvt_driver_qp_init(). Overwise this pointer > doesn't changed and passed to rvt_qp_exit() by the next step. > > Found by Linux Verification Center (linuxtesting.org) with SVACE. > > [...] Applied, thanks! [1/1] rdmavt: delete unnecessary NULL check https://git.kernel.org/rdma/rdma/c/9b3366ec12f0d7 Best regards,
diff --git a/drivers/infiniband/sw/rdmavt/qp.c b/drivers/infiniband/sw/rdmavt/qp.c index 3acab569fbb9..2bdc4486c3da 100644 --- a/drivers/infiniband/sw/rdmavt/qp.c +++ b/drivers/infiniband/sw/rdmavt/qp.c @@ -464,8 +464,6 @@ void rvt_qp_exit(struct rvt_dev_info *rdi) if (qps_inuse) rvt_pr_err(rdi, "QP memory leak! %u still in use\n", qps_inuse); - if (!rdi->qp_dev) - return; kfree(rdi->qp_dev->qp_table); free_qpn_table(&rdi->qp_dev->qpn_table);