Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp2315678rdb; Thu, 21 Sep 2023 15:13:17 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH+X0H/oFMxKcPfy+89eFTOLCjiLEebS5b3k2nRT7xaBCuZhqx+rUYdpUV3eJKz//GEHUi8 X-Received: by 2002:a05:6808:11c3:b0:3a4:894a:9f3d with SMTP id p3-20020a05680811c300b003a4894a9f3dmr7318153oiv.41.1695334396953; Thu, 21 Sep 2023 15:13:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695334396; cv=none; d=google.com; s=arc-20160816; b=xypHvdGlA3L1HiU1gobtfVXPsHCT+nO7JFh+d/HkPQfcZIdFtBO12z4AZd280XaQLc /UcSM9Tuax7m1i5/abJVeVfmzX0iEf5qU8eJ2c0Uf5mEv06fHSMPPJfNdWpjP1rUzxQD 5bthgsGHEz7mJbDvpa35fi6/5p2feLfY98zfsuOeGiZZNZB0ki4biBCOO96NIj7Na0ch mrUb51EKjne56G1ID9y2DTU0hvdnLw0qiDTBFOdnv9hOI0ptdzXOBjrouh/vVhzQ4X1P 5N0GgQrfn+xS94e41LAPoKYTEfJGMFC4FB8OxnOklJVibid3Y9R+eky37jj8ij4Eof96 AiIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=0Cteosbrp2yJQxUSMRjtLK1wYIvhi6jP9cwsye5TkLg=; fh=GVLkKWfjRdVgvdPL1DugJAxjjWL6OxUOOnw+KLzqTSo=; b=kHsLjiArfQpXl3lyDctF/lW3H/9fD8OwOHdpsLwp9uIqVc6MSv/BYxmIEtBGj2mWIR I8G5E9FEyRoa9cahP/Zn22+iqETlaipKiFjcWl4lFzjEP3LARSQ9z2TpfLF2yGgeEMkp f99MtBPgOBFKNu9hLZW3Ja07/XOYqLasoDdrA00XiWZlr35URDCqG603MUgPYAwu1Lfs h7ohpaBsLzoooGdT/XjO2WOYfzwrTnL+uLENLQKOgcA1KlaU5JcIbDwZ6Ejj+HLnZjqh 6iBXo7nkRiMHjkwdxEHHye1jbedM12UIWgUq7IhlX1J/URYj4DxYP0qUQ7VErrko0R80 NPFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=lb1ItmWr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id cb11-20020a056a00430b00b0068e380c3654si2423620pfb.395.2023.09.21.15.13.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 15:13:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=lb1ItmWr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id B54288539E18; Thu, 21 Sep 2023 14:58:58 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232244AbjIUV7A (ORCPT + 99 others); Thu, 21 Sep 2023 17:59:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46172 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233346AbjIUV6l (ORCPT ); Thu, 21 Sep 2023 17:58:41 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2CFC59156; Thu, 21 Sep 2023 13:42:00 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 54247C433C9; Thu, 21 Sep 2023 20:41:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1695328920; bh=I1qPjPwX/ZgiQ8faFls/NRFN0ufD5XwNyu1yGXX83gg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=lb1ItmWrkhLoMDVa3VWNIUYsonRsAac6VG5D4Co/JV+m6nZDuol2aUe2vk2x/O9D4 hpeQmXHfUyeFIV09+kGiCu8iMai7dBxHEM016VFmD/OAEbY6dzlaLPjmHnIOGhByi1 XrbTgtJ/gRHr9RZOo7XCXkj9nrSyhvtD+n3LXW8R3EzhV/z3OC+iVbl1iaNIHe6/Be Pp9tBmrlnDnpn8H8iJj7h+n8TjYgFOvvUNfayCtE8YlS3yA0t97uWmRzdm8UfWCeA9 UCy2rTD+kMmdafDZc5JAPjw0yYUyt3js5+j+KRfxJk4l/9RRWSQOAI6ZuZb+G2J78D 63FP/knQMriBg== Date: Thu, 21 Sep 2023 21:41:53 +0100 From: Simon Horman To: Wen Gu Cc: kgraul@linux.ibm.com, wenjia@linux.ibm.com, jaka@linux.ibm.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, alibuda@linux.alibaba.com, tonylu@linux.alibaba.com, linux-s390@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net-next 01/18] net/smc: decouple ism_dev from SMC-D device dump Message-ID: <20230921204153.GQ224399@kernel.org> References: <1695134522-126655-1-git-send-email-guwen@linux.alibaba.com> <1695134522-126655-2-git-send-email-guwen@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1695134522-126655-2-git-send-email-guwen@linux.alibaba.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, 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: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Thu, 21 Sep 2023 14:58:58 -0700 (PDT) On Tue, Sep 19, 2023 at 10:41:45PM +0800, Wen Gu wrote: > This patch helps to decouple ISM device from SMC-D device, allowing > different underlying device forms, such as virtual ISM devices. > > Signed-off-by: Wen Gu > --- > net/smc/smc_ism.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/net/smc/smc_ism.c b/net/smc/smc_ism.c > index fbee249..0045fee 100644 > --- a/net/smc/smc_ism.c > +++ b/net/smc/smc_ism.c > @@ -230,12 +230,11 @@ static int smc_nl_handle_smcd_dev(struct smcd_dev *smcd, > char smc_pnet[SMC_MAX_PNETID_LEN + 1]; > struct smc_pci_dev smc_pci_dev; > struct nlattr *port_attrs; > + struct device *priv_dev; > struct nlattr *attrs; > - struct ism_dev *ism; > int use_cnt = 0; > void *nlh; > > - ism = smcd->priv; > nlh = genlmsg_put(skb, NETLINK_CB(cb->skb).portid, cb->nlh->nlmsg_seq, > &smc_gen_nl_family, NLM_F_MULTI, > SMC_NETLINK_GET_DEV_SMCD); > @@ -250,7 +249,10 @@ static int smc_nl_handle_smcd_dev(struct smcd_dev *smcd, > if (nla_put_u8(skb, SMC_NLA_DEV_IS_CRIT, use_cnt > 0)) > goto errattr; > memset(&smc_pci_dev, 0, sizeof(smc_pci_dev)); Hi Wen Gu, priv_dev is uninitialised here. > - smc_set_pci_values(to_pci_dev(ism->dev.parent), &smc_pci_dev); > + if (smcd->ops->get_dev) > + priv_dev = smcd->ops->get_dev(smcd); It is conditionally initialised here. > + if (priv_dev->parent) But unconditionally dereferenced here. As flagged by clang-16 W=1, and Smatch > + smc_set_pci_values(to_pci_dev(priv_dev->parent), &smc_pci_dev); > if (nla_put_u32(skb, SMC_NLA_DEV_PCI_FID, smc_pci_dev.pci_fid)) > goto errattr; > if (nla_put_u16(skb, SMC_NLA_DEV_PCI_CHID, smc_pci_dev.pci_pchid)) > -- > 1.8.3.1 > >