netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Adam Young <admiyo@os.amperecomputing.com>
Cc: Jeremy Kerr <jk@codeconstruct.com.au>,
	Matt Johnston <matt@codeconstruct.com.au>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Sudeep Holla <sudeep.holla@arm.com>,
	Jonathan Cameron <Jonathan.Cameron@huawei.com>,
	Huisong Li <lihuisong@huawei.com>
Subject: Re: [PATCH net-next v29 3/3] mctp pcc: Implement MCTP over PCC Transport
Date: Fri, 26 Sep 2025 15:16:50 +0100	[thread overview]
Message-ID: <aNagUmU8GOMbpfGq@horms.kernel.org> (raw)
In-Reply-To: <20250925190027.147405-4-admiyo@os.amperecomputing.com>

On Thu, Sep 25, 2025 at 03:00:26PM -0400, Adam Young wrote:

...

> +static int initialize_MTU(struct net_device *ndev)
> +{
> +	struct mctp_pcc_ndev *mctp_pcc_ndev = netdev_priv(ndev);
> +	struct mctp_pcc_mailbox *outbox;
> +	int mctp_pcc_mtu;
> +
> +	outbox = &mctp_pcc_ndev->outbox;
> +	outbox->chan = pcc_mbox_request_channel(&outbox->client, outbox->index);
> +	mctp_pcc_mtu = outbox->chan->shmem_size - sizeof(struct pcc_header);

Hi Adam,

On the line below it is expected that outbox->chan may be an error value
rather than a valid pointer. But on the line above outbox->chan is
dereferenced.

This does not seem consistent.

Flagged by Smatch.

> +	if (IS_ERR(outbox->chan))
> +		return PTR_ERR(outbox->chan);
> +
> +	pcc_mbox_free_channel(mctp_pcc_ndev->outbox.chan);
> +
> +	mctp_pcc_ndev = netdev_priv(ndev);
> +	ndev->mtu = MCTP_MIN_MTU;
> +	ndev->max_mtu = mctp_pcc_mtu;
> +	ndev->min_mtu = MCTP_MIN_MTU;
> +
> +	return 0;
> +}

...

-- 
pw-bot: changes-requested

  reply	other threads:[~2025-09-26 14:16 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-25 19:00 [PATCH net-next v29 0/3] MCTP Over PCC Transport Adam Young
2025-09-25 19:00 ` [PATCH net-next v29 1/3] mailbox: add callback function for rx buffer allocation Adam Young
2025-09-26 14:13   ` Simon Horman
2025-09-26 15:44   ` Sudeep Holla
2025-10-05  5:13   ` Adam Young
2025-10-05 23:34     ` Jassi Brar
2025-10-06  8:54       ` Sudeep Holla
2025-10-06 15:24       ` Adam Young
2025-10-06 15:48         ` Sudeep Holla
2025-09-25 19:00 ` [PATCH net-next v29 2/3] mailbox/pcc: use mailbox-api level rx_alloc callback Adam Young
2025-09-25 19:00 ` [PATCH net-next v29 3/3] mctp pcc: Implement MCTP over PCC Transport Adam Young
2025-09-26 14:16   ` Simon Horman [this message]
2025-09-26 16:06   ` [External] : " ALOK TIWARI

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=aNagUmU8GOMbpfGq@horms.kernel.org \
    --to=horms@kernel.org \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=admiyo@os.amperecomputing.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jk@codeconstruct.com.au \
    --cc=kuba@kernel.org \
    --cc=lihuisong@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matt@codeconstruct.com.au \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sudeep.holla@arm.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;
as well as URLs for NNTP newsgroup(s).