From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6C5B8C43334 for ; Thu, 9 Jun 2022 02:32:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232714AbiFICc2 (ORCPT ); Wed, 8 Jun 2022 22:32:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58598 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230391AbiFICc1 (ORCPT ); Wed, 8 Jun 2022 22:32:27 -0400 Received: from out199-3.us.a.mail.aliyun.com (out199-3.us.a.mail.aliyun.com [47.90.199.3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B722F31DD9 for ; Wed, 8 Jun 2022 19:32:25 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R301e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046051;MF=chengyou@linux.alibaba.com;NM=1;PH=DS;RN=2;SR=0;TI=SMTPD_---0VFpU7Lf_1654741940; Received: from 30.43.106.59(mailfrom:chengyou@linux.alibaba.com fp:SMTPD_---0VFpU7Lf_1654741940) by smtp.aliyun-inc.com; Thu, 09 Jun 2022 10:32:21 +0800 Message-ID: Date: Thu, 9 Jun 2022 10:32:18 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Subject: Re: [bug report] RDMA/erdma: Add verbs implementation Content-Language: en-US To: Dan Carpenter Cc: linux-rdma@vger.kernel.org References: From: Cheng Xu In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org On 6/8/22 8:56 PM, Dan Carpenter wrote: > Hello Cheng Xu, > > The patch c4612e83c14b: "RDMA/erdma: Add verbs implementation" from > May 23, 2022, leads to the following Smatch static checker warning: > > drivers/infiniband/hw/erdma/erdma_verbs.c:111 create_qp_cmd() > error: uninitialized symbol 'resp0'. > > drivers/infiniband/hw/erdma/erdma_verbs.c > 100 req.sq_buf_addr = user_qp->sq_mtt.mtt_entry[0]; > 101 req.rq_buf_addr = user_qp->rq_mtt.mtt_entry[0]; > 102 > 103 req.sq_db_info_dma_addr = user_qp->sq_db_info_dma_addr; > 104 req.rq_db_info_dma_addr = user_qp->rq_db_info_dma_addr; > 105 } > 106 > 107 err = erdma_post_cmd_wait(&dev->cmdq, (u64 *)&req, sizeof(req), &resp0, > 108 &resp1); > > The erdma_post_cmd_wait() function does not initialize erdma_post_cmd_wait() > on the error paths. Oh, I knew this before: since erdma_post_cmd_wait returns error, the qp 's resource will destroy soon, the uninitialized value of resp0 will influence nothing. So here I reduce a condition judgement. Anyway, I will fix it to eliminate the static checker warning. > Also it returns comp_wait->comp_status which is a u8. I guess that's > some kind of custom error code. Mixing kernel and custom error codes > is dangerous. I think it's a bug in this case. > I will fix it in the next version of our patches. Thanks, Cheng Xu