public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Wen Gu <guwen@linux.alibaba.com>
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
Date: Thu, 21 Sep 2023 21:41:53 +0100	[thread overview]
Message-ID: <20230921204153.GQ224399@kernel.org> (raw)
In-Reply-To: <1695134522-126655-2-git-send-email-guwen@linux.alibaba.com>

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 <guwen@linux.alibaba.com>
> ---
>  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
> 
> 

  reply	other threads:[~2023-09-21 21:58 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-19 14:41 [PATCH net-next 00/18] net/smc: implement virtual ISM extension and loopback-ism Wen Gu
2023-09-19 14:41 ` [PATCH net-next 01/18] net/smc: decouple ism_dev from SMC-D device dump Wen Gu
2023-09-21 20:41   ` Simon Horman [this message]
2023-09-22  8:05     ` Wen Gu
2023-09-22 18:13       ` Gerd Bayer
2023-09-23  9:24         ` Wen Gu
2023-09-19 14:41 ` [PATCH net-next 02/18] net/smc: decouple ism_dev from SMC-D DMB registration Wen Gu
2023-09-19 14:41 ` [PATCH net-next 03/18] net/smc: extract v2 check helper from SMC-D device registration Wen Gu
2023-09-19 14:41 ` [PATCH net-next 04/18] net/smc: support SMCv2.x supplemental features negotiation Wen Gu
2023-09-19 14:41 ` [PATCH net-next 05/18] net/smc: reserve CHID range for SMC-D virtual device Wen Gu
2023-09-19 14:41 ` [PATCH net-next 06/18] net/smc: extend GID to 128bits for virtual ISM device Wen Gu
2023-09-20  7:02   ` kernel test robot
2023-09-20  8:11     ` Wen Gu
2023-09-20  9:00       ` Niklas Schnelle
2023-09-20 13:05         ` Wen Gu
2023-09-19 14:41 ` [PATCH net-next 07/18] net/smc: disable SEID on non-s390 architecture Wen Gu
2023-09-19 14:41 ` [PATCH net-next 08/18] net/smc: enable virtual ISM device feature bit Wen Gu
2023-09-19 14:41 ` [PATCH net-next 09/18] net/smc: introduce SMC-D loopback device Wen Gu
2023-09-19 14:41 ` [PATCH net-next 10/18] net/smc: implement ID-related operations of loopback Wen Gu
2023-09-19 14:41 ` [PATCH net-next 11/18] net/smc: implement some unsupported " Wen Gu
2023-09-19 14:41 ` [PATCH net-next 12/18] net/smc: implement DMB-related " Wen Gu
2023-09-23 15:24   ` kernel test robot
2023-09-24  8:54     ` Wen Gu
2023-09-19 14:41 ` [PATCH net-next 13/18] net/smc: register loopback device as SMC-Dv2 device Wen Gu
2023-09-19 14:41 ` [PATCH net-next 14/18] net/smc: add operation for getting DMB attribute Wen Gu
2023-09-19 14:41 ` [PATCH net-next 15/18] net/smc: add operations for DMB attach and detach Wen Gu
2023-09-19 14:42 ` [PATCH net-next 16/18] net/smc: avoid data copy from sndbuf to peer RMB in SMC-D Wen Gu
2023-09-19 14:42 ` [PATCH net-next 17/18] net/smc: modify cursor update logic when sndbuf mapped to RMB Wen Gu
2023-09-19 14:42 ` [PATCH net-next 18/18] net/smc: add interface implementation of loopback device Wen Gu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230921204153.GQ224399@kernel.org \
    --to=horms@kernel.org \
    --cc=alibuda@linux.alibaba.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=guwen@linux.alibaba.com \
    --cc=jaka@linux.ibm.com \
    --cc=kgraul@linux.ibm.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=tonylu@linux.alibaba.com \
    --cc=wenjia@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox