Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp1007096iog; Mon, 13 Jun 2022 18:45:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyRQtcGJC3GDPJmwpWd7p5j/VE36hrRtaC0XmORwo3t5QJ20kk8dmYHi8dpA6WEuSIBm9Yo X-Received: by 2002:a17:906:149:b0:712:502:bc62 with SMTP id 9-20020a170906014900b007120502bc62mr2245359ejh.720.1655171140105; Mon, 13 Jun 2022 18:45:40 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1655171140; cv=pass; d=google.com; s=arc-20160816; b=ZhDsptP5gPu2aNeN63FogGxT9o/GVUtFP71YxgtpOd2ssNNvYyI+4BNwIBt8fZCTIj vU6mBgqyMKnCpfbg1vfxboVpcNswL2gml01+RrVS3yj3HOHk6//OVeTKO59sOIAPDBkb tmTJxe9Ju/ezyzb0q6t5tsifhLRj5XgaRjs/GyqOUdHxvms3nSIr9dXYpvTWVefJyheB 6dxEPHAN6wYH1nM74YhGf4qmGyAi6dTN+Q5XRC6A8gXZd8YbE+cUlV0qP2v5jFd7ttvB QEi2qTsc7HlBjZfp8qr8F4GUG1Vd+sXCaK8eki8CxmOyFlov/7J9t6WiYlkU4w8rlUCz tIFg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :in-reply-to:from:references:cc:to:content-language:subject :user-agent:date:message-id:dkim-signature; bh=QLTppljV1U+xDvvGKiGI0OF1yZwJltMDxdD2orSDhcE=; b=Gp4X0kx5LWb2oSPsRnou9UnSPzrBcKykCgCT0N5JOW4IEsVxSBvoBAag4Es4Dxchu+ 3MyredJjqS+FzMIgXJLkJ03aBpf3/n3kfADeTeLOc9Joq8KQ29fc5HLDbkJPKrTtB+/n aWMko9AkZ/lhISLeV0NJQw6CinXv6vHygINS7yZPfBpbn1LSo0rhmjjIGlJcIdijUyTI PcLT83f7viBbhEtQWga0KIEiVEH9U/KRyD1/IsQfhFEQGjbZFSROjfTd3AAPf0ukaV5h oXm5vcY1bKMe/z0pnvbuanupeR4CzS0ZRnJD+w8hIqNoVPPrK++unX6Tf6OluAyx8/R4 7/rA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=JwPkZ0N9; arc=pass (i=1 spf=pass spfdomain=nvidia.com dkim=pass dkdomain=nvidia.com dmarc=pass fromdomain=nvidia.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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g12-20020aa7c58c000000b0042acd8ede70si8498814edq.573.2022.06.13.18.45.15; Mon, 13 Jun 2022 18:45:40 -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=@Nvidia.com header.s=selector2 header.b=JwPkZ0N9; arc=pass (i=1 spf=pass spfdomain=nvidia.com dkim=pass dkdomain=nvidia.com dmarc=pass fromdomain=nvidia.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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347583AbiFNBTf (ORCPT + 99 others); Mon, 13 Jun 2022 21:19:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59502 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347396AbiFNBTd (ORCPT ); Mon, 13 Jun 2022 21:19:33 -0400 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2064.outbound.protection.outlook.com [40.107.237.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B401CBE0B; Mon, 13 Jun 2022 18:19:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OzUQ6N9di6W1JKmOdaYbX08vvPAn+stPLVu57lHXGgFPVNKwiuq+zjjEZ2ArYlGa0NghVnxbULH37i51QlZTIYx1ekBYSiKrWgIuPZjPCMLXwoLsxfoK7t9nfMj3G4xurEofUGIWmtPGcJdvp+1EBGiXKJ6H878bop+2eXXVvIMoImgE5dBaV4w4N/o+gmdKVSvnXgHOX9IvCytDRsuF9Gb0aY0o+exbKE8Jtw4ldOX2zbeK6yExjiqB6Q3jMpD+L805qtTOFquXi407dSsxl6tWSr2Eq9QCkR4kP3VaROKq2KziyjSYRKWkurfcUiM1CSR21Q2wbpCi3gRp6WCFlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=QLTppljV1U+xDvvGKiGI0OF1yZwJltMDxdD2orSDhcE=; b=NB+iNyXbkP5pfDm6iSSsHtMEAnb9zxSxkHTCGCEjNUcwwZwI1v//TUVJIia/VTG6Ws9mE4GpNVDiM63ICmX1V2j/uuUK9cNV4SLMYPFvZb67f3XLlD92wgdO0f8lX1Ho2/J32/tB4ZHLcTsFE3ko+LSKfn3hKskxiyJGSE0txbdeKzOzrPeerWhtvbxnsTu99Ji9JAZxQazqBfbdNkWqPOvdB0VzR+aiyDSds5M0kkEbHpHkT06L8V6ZtKYJEU6Z3STryMtdl6sFNqJX6E6KxFMMVN80UWQtCAm++BZoEFmcmOK5ud2udectCp2w/1tuSgw738CwN+41RjaOez/1Kw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=QLTppljV1U+xDvvGKiGI0OF1yZwJltMDxdD2orSDhcE=; b=JwPkZ0N94FXckog5AP600y0+18YAnVAsmOgHVi0mcxGwszTWlrYkIFe3Bis3FJ/Ph/j5Ab6ASJFyQp1xPzju+SSbozqptpbAIT86GFun8HjdiIAYsFPoa3ob5Gj8jzgIcII45ngz5z0PiGG19jWs8f33HjWDHVUNowFw13OEGyLQCfPQtKPNQqoy78MOm5786II8p7NXm0/WU4DP49jfmIdg5Bp5vmc539KM3fTjkmdCBb+ToFWgtVYhHlBx3FuTEvijhYVmufgn8PUAhvrg54qJe0Sb0i5fYK0Jva8mFIqxkoadq9vIeFL0ejhfAKkZZL4FHPHjEktaJvxTnx3AqA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from CY4PR12MB1366.namprd12.prod.outlook.com (2603:10b6:903:40::13) by DM5PR12MB2456.namprd12.prod.outlook.com (2603:10b6:4:b4::37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5332.12; Tue, 14 Jun 2022 01:19:24 +0000 Received: from CY4PR12MB1366.namprd12.prod.outlook.com ([fe80::dd48:8d3b:7eac:ea85]) by CY4PR12MB1366.namprd12.prod.outlook.com ([fe80::dd48:8d3b:7eac:ea85%10]) with mapi id 15.20.5332.020; Tue, 14 Jun 2022 01:19:24 +0000 Message-ID: Date: Tue, 14 Jun 2022 09:19:14 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Subject: Re: [PATCH] RDMA/cm: fix cond_no_effect.cocci warnings Content-Language: en-US To: Jiapeng Chong , jgg@ziepe.ca Cc: leon@kernel.org, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, Abaci Robot References: <20220610094530.28950-1-jiapeng.chong@linux.alibaba.com> From: Mark Zhang In-Reply-To: <20220610094530.28950-1-jiapeng.chong@linux.alibaba.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: SG2PR06CA0204.apcprd06.prod.outlook.com (2603:1096:4:1::36) To CY4PR12MB1366.namprd12.prod.outlook.com (2603:10b6:903:40::13) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c165f0e2-d531-4157-12e9-08da4da3eab2 X-MS-TrafficTypeDiagnostic: DM5PR12MB2456:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: aNRnFcweeTCJcz02yiaBGyoi6PdZe7PR+JTYMPN0pHeb4qHThNXH3nsSoneTQA3b6frI33qp35bSYVMJIibCxml5L/eOdC78KUiwgfvDJHH2u060RrGmY+QUSL70nJ6t6vyx3awx3ER+PRmbnLurqzD7lFCnZePGjWGxXbgMZDJwHcTwrOVpKtHzh4Be/PMRq96dW7UvgCc7sVaCm4QnjiTreQfmEfDedAXXJdDsNQBzOfUPNJycfecht2mtRA7om9c/I/DbbwM1FeT8iLBFmyLbwa7SlTTg7PleWEtV4N8LMo/zpWlFsBUZu6Qge4NjtnsuW2B8gje6qa/cqPTshRXz2aNlYwjWsYZXz3rVBNC8LwqWwuASwpTU7KbovJwYrQtnTn5/nd3tw3LGj1FJ6FLDFoULOH7SQTRC1pIrtymYoMxw91rUHEmwPGZHkzDo555DkHLmxYbL84g18rLH8duZvqNx1dnap6/DX2OScw1tkfkOCCW6OsYUxLjkQ9fLfk4XBTqljVOLyQGs9WAVkmZeCZvvK0f0FNvAvR7DsU5UkCXWHilI5hrAv2ch85yJ7U33n2d86tSQ59Elo7RdbWzdbZZwJIXLF1fdL1oY+9dgeIyNdBM0k36TOdLzCg4dI7U2Kjxj5J/EWKVLprT7tdWBd7LtvaMSqKWdncqAmdsy7J9f1P6Z44/lvFKGy2UzXiGKu/I0tsXjPLx1UMs0bdyor8R+bDZKRyfm1Hc3brgn1ltfeW9xyHZ95Ti9Y7yk X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY4PR12MB1366.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(4636009)(366004)(2906002)(26005)(38100700002)(53546011)(6666004)(6506007)(2616005)(186003)(6512007)(83380400001)(5660300002)(4326008)(8676002)(36756003)(316002)(31696002)(66946007)(86362001)(508600001)(66556008)(8936002)(66476007)(6486002)(31686004)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?MDRPM3hCNFNxWnBTeVp1UW1LTWpLVERvVldoazFLZExIT3VnVDBmVmdVdDlt?= =?utf-8?B?N29YSUVueTNjTnR1dFByN0Z5K0tXSEptS1h6eUFTeWlnd2poWURMZmZtYnhi?= =?utf-8?B?dyt2SW9saHdFbENWVC90VThmV29IUk54c2k5MnVSR2F5VWR3RS96MWZrTzlQ?= =?utf-8?B?VUVNN3gvQ2ZMWmZjSkUrT1FsWnBQSnYvbDRWZStxREFUZFlFN1hjZFFHY29v?= =?utf-8?B?M0dtSHBubmtST1NVSnRuQXpPamhwVWxmRzNoWHNZNWRDVzVhdDhuMGVNMFlo?= =?utf-8?B?YjZFM3VZT0ZRdlhYcEkzaDhxeHRFMjdjSDgzKzN6akxGZ29XWk9YWkxsVWlZ?= =?utf-8?B?S2xwckdKWExVSmN2T1hkTXhRL21uT00zSEgzT1Z3aVE2Ql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NMSVB5QThTT245MWxDZW5aSEZNRlBRdlluWXV4?= =?utf-8?B?OEl5RXl2ZTMwNDFDMjVETlFFTzNaTy9EMHkvU0h5RjRYOWVRRmR2SytGdStU?= =?utf-8?B?S0lGaHlLQnRWN0FYczM5WmF0bU53TEJDaGkyZ3AzQjdheW1pcnAyUT09?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: c165f0e2-d531-4157-12e9-08da4da3eab2 X-MS-Exchange-CrossTenant-AuthSource: CY4PR12MB1366.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2022 01:19:24.2330 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: aMJuFqWAXMHsr6rrLmlwnNZIbcUSOD92wbEM2W0QwEuOnbOwJuhhi5ukg69AChuyGvnK94WSM1Mr7oVvyXervA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB2456 X-Spam-Status: No, score=-3.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_NONE,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 On 6/10/2022 5:45 PM, Jiapeng Chong wrote: > This was found by coccicheck: > > ./drivers/infiniband/core/cm.c:685:7-9: WARNING: possible condition with no effect (if == else). > > Reported-by: Abaci Robot > Signed-off-by: Jiapeng Chong > --- > drivers/infiniband/core/cm.c | 9 ++------- > 1 file changed, 2 insertions(+), 7 deletions(-) > > diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c > index 1c107d6d03b9..bb6a2b6b9657 100644 > --- a/drivers/infiniband/core/cm.c > +++ b/drivers/infiniband/core/cm.c > @@ -676,14 +676,9 @@ static struct cm_id_private *cm_find_listen(struct ib_device *device, > refcount_inc(&cm_id_priv->refcount); > return cm_id_priv; > } > - if (device < cm_id_priv->id.device) > + if (device < cm_id_priv->id.device || > + be64_lt(service_id, cm_id_priv->id.service_id)) > node = node->rb_left; > - else if (device > cm_id_priv->id.device) > - node = node->rb_right; > - else if (be64_lt(service_id, cm_id_priv->id.service_id)) > - node = node->rb_left; > - else if (be64_gt(service_id, cm_id_priv->id.service_id)) > - node = node->rb_right; > else > node = node->rb_right; > } Not sure if the fix is correct, e.g. with this condition: device > cm_id_priv->id.device && be64_lt(service_id, cm_id_priv->id.service_id) The original code gets rb_right but this fix gets rb_left. Maybe the warning is complain about this: ... else if (be64_gt(service_id, cm_id_priv->id.service_id)) node = node->rb_right; else node = node->rb_right; Besides cm_insert_listen() has same logic.